Class: Duby::AST::EmptyArray
- Defined in:
- lib/duby/ast/type.rb,
lib/duby/compiler.rb
Instance Attribute Summary collapse
-
#component_type ⇒ Object
Returns the value of attribute component_type.
-
#size ⇒ Object
Returns the value of attribute size.
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, type, &block) ⇒ EmptyArray
constructor
A new instance of EmptyArray.
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, type, &block) ⇒ EmptyArray
Returns a new instance of EmptyArray.
78 79 80 81 82 83 84 85 |
# File 'lib/duby/ast/type.rb', line 78 def initialize(parent, line_number, type, &block) super(parent, line_number, []) @component_type = type @size = size @inferred_type = Duby::AST::type(type.name, true) @size = yield(self) end |
Instance Attribute Details
#component_type ⇒ Object
Returns the value of attribute component_type.
77 78 79 |
# File 'lib/duby/ast/type.rb', line 77 def component_type @component_type end |
#size ⇒ Object
Returns the value of attribute size.
76 77 78 |
# File 'lib/duby/ast/type.rb', line 76 def size @size end |
Instance Method Details
#compile(compiler, expression) ⇒ Object
260 261 262 263 264 265 |
# File 'lib/duby/compiler.rb', line 260 def compile(compiler, expression) if expression compiler.line(line_number) compiler.empty_array(component_type, size) end end |
#infer(typer) ⇒ Object
87 88 89 90 91 |
# File 'lib/duby/ast/type.rb', line 87 def infer(typer) typer.infer(size) resolved! return @inferred_type end |