avatar

566

Upgrade to JRuby 1.1.3 for the scripting side of things. by mrs, 23 Jul, 2008 08:53 PM
Diff this changeset:
structure.rb
      module Duby::AST
  class Body < Node
    def initialize(parent)
      super(parent, yield(self))
    end
        
    # Type of a block is the type of its final element
    def infer(typer)
      unless @inferred_type
        if children.size == 0
          @inferred_type = typer.default_type
        else
          children.each {|child| @inferred_type = child.infer(typer)}
        end
          
        unless @inferred_type
          typer.defer(self)
        end
      end

      @inferred_type
    end
  end
  
  class Noop < Node
    def infer(typer)
      @inferred_type ||= typer.default_type
    end
  end
  
  class Script < Node
    include Scope
    attr_accessor :body
    
    def initialize(parent)
      @body = (children = yield(self))[0]
      super(parent, children)
    end
    
    def infer(typer)
      @inferred_type ||= body.infer(typer) || (typer.defer(self); nil)
    end
  end
end
    

Check out the code: svn co jbidwatcher/trunk/lib/ruby/site_ruby/1.8/duby/ast/structure.rb