Class: Duby::AST::BindingReference
- Defined in:
- lib/duby/compiler.rb,
lib/duby/ast/structure.rb
Instance Attribute Summary
Attributes inherited from Node
#children, #inferred_type, #newline, #parent, #position
Instance Method Summary collapse
- #compile(compiler, expression) ⇒ Object
- #infer(typer) ⇒ Object
-
#initialize(parent, position, type) ⇒ BindingReference
constructor
A new instance of BindingReference.
Methods inherited from Node
#<<, ===, #[], #_set_parent, child, child_name, #each, #empty?, #expr?, #initialize_copy, #insert, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp, #to_s
Constructor Details
#initialize(parent, position, type) ⇒ BindingReference
Returns a new instance of BindingReference.
110 111 112 113 |
# File 'lib/duby/ast/structure.rb', line 110 def initialize(parent, position, type) super(parent, position) @inferred_type = type end |
Instance Method Details
#compile(compiler, expression) ⇒ Object
329 330 331 332 333 334 |
# File 'lib/duby/compiler.rb', line 329 def compile(compiler, expression) if expression compiler.line(line_number) compiler.binding_reference end end |
#infer(typer) ⇒ Object
115 116 117 118 |
# File 'lib/duby/ast/structure.rb', line 115 def infer(typer) resolved! unless resolved? @inferred_type end |