Class: Duby::AST::Null
- Includes:
- Literal
- Defined in:
- lib/duby/compiler.rb,
lib/duby/ast/literal.rb
Instance Attribute Summary
Attributes included from Literal
Attributes included from Typed
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) ⇒ Null
constructor
A new instance of Null.
Methods included from Literal
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) ⇒ Null
Returns a new instance of Null.
138 139 140 |
# File 'lib/duby/ast/literal.rb', line 138 def initialize(parent, line_number) super(parent, line_number) end |
Instance Method Details
#compile(compiler, expression) ⇒ Object
269 270 271 272 273 274 |
# File 'lib/duby/compiler.rb', line 269 def compile(compiler, expression) if expression compiler.line(line_number) compiler.null end end |
#infer(typer) ⇒ Object
142 143 144 145 146 |
# File 'lib/duby/ast/literal.rb', line 142 def infer(typer) return @inferred_type if resolved? resolved! @inferred_type ||= typer.null_type end |