Class: Duby::AST::Return
- Includes:
- Valued
- Defined in:
- lib/duby/ast/flow.rb,
lib/duby/compiler.rb,
lib/duby/jvm/source_generator/precompile.rb
Instance Attribute Summary
Attributes included from Valued
Attributes included from Typed
Attributes inherited from Node
#children, #inferred_type, #newline, #parent, #position
Instance Method Summary collapse
- #compile(compiler, expression) ⇒ Object
- #expr?(compiler) ⇒ Boolean
- #infer(typer) ⇒ Object
-
#initialize(parent, line_number, &block) ⇒ Return
constructor
A new instance of Return.
Methods inherited from Node
#<<, ===, #[], #_set_parent, child, child_name, #each, #empty?, #initialize_copy, #insert, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp, #to_s
Constructor Details
#initialize(parent, line_number, &block) ⇒ Return
Returns a new instance of Return.
195 196 197 |
# File 'lib/duby/ast/flow.rb', line 195 def initialize(parent, line_number, &block) super(parent, line_number, &block) end |
Instance Method Details
#compile(compiler, expression) ⇒ Object
253 254 255 256 |
# File 'lib/duby/compiler.rb', line 253 def compile(compiler, expression) compiler.line(line_number) compiler.return(self) end |
#expr?(compiler) ⇒ Boolean
152 153 154 |
# File 'lib/duby/jvm/source_generator/precompile.rb', line 152 def expr?(compiler) false end |
#infer(typer) ⇒ Object
199 200 201 202 203 204 205 206 207 |
# File 'lib/duby/ast/flow.rb', line 199 def infer(typer) unless resolved? @inferred_type = typer.infer(value) (@inferred_type && value.resolved?) ? resolved! : typer.defer(self) end @inferred_type end |