Sha256: 4ca21bedd6fe6f794e002c0d2a5709aedb9ec7ebb7d622f4656a5fa22f750268
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
module Duby::AST class LocalDeclaration < Node include Named include Typed include Scoped def initialize(parent, line_number, name, captured=false, &block) super(parent, line_number, &block) @name = name @captured = captured @type = children[0] end def captured? @captured end def infer(typer) unless resolved? resolved! @inferred_type = typer.known_types[type] || type if @inferred_type resolved! typer.learn_local_type(scope, name, @inferred_type) else typer.defer(self) end end @inferred_type end end class LocalAssignment < Node include Named include Valued include Scoped def initialize(parent, line_number, name, captured=false, &block) super(parent, line_number, children, &block) @captured = captured @value = children[0] @name = name end def captured? @captured end def to_s "LocalAssignment(name = #{name}, scope = #{scope}, captured = #{captured?})" end def infer(typer) unless @inferred_type @inferred_type = typer.learn_local_type(scope, name, typer.infer(value)) @inferred_type ? resolved! : typer.defer(self) end @inferred_type end end class Local < Node include Named include Scoped def initialize(parent, line_number, name, captured=false) super(parent, line_number, []) @name = name @captured = captured end def captured? @captured end def to_s "Local(name = #{name}, scope = #{scope}, captured = #{captured?})" end def infer(typer) unless @inferred_type @inferred_type = typer.local_type(scope, name) @inferred_type ? resolved! : typer.defer(self) end @inferred_type end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
duby-0.0.2-java | lib/duby/ast/local.rb |