Class: Duby::AST::Array
- Defined in:
- lib/duby/compiler.rb,
lib/duby/ast/literal.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, line_number, &block) ⇒ Array
constructor
A new instance of Array.
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, line_number, &block) ⇒ Array
Returns a new instance of Array.
3 4 5 |
# File 'lib/duby/ast/literal.rb', line 3 def initialize(parent, line_number, &block) super(parent, line_number, &block) end |
Instance Method Details
#compile(compiler, expression) ⇒ Object
63 64 65 |
# File 'lib/duby/compiler.rb', line 63 def compile(compiler, expression) compiler.array(self, expression) end |
#infer(typer) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/duby/ast/literal.rb', line 7 def infer(typer) children.each do |kid| kid.infer(typer) end @inferred_type = typer.array_type end |