Class: Duby::AST::Script
- Defined in:
- lib/duby/compiler.rb,
lib/duby/ast/structure.rb
Instance Attribute Summary collapse
-
#defining_class ⇒ Object
Returns the value of attribute defining_class.
Attributes included from Scope
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) ⇒ Script
constructor
A new instance of Script.
Methods included from Binding
#binding_type, #binding_type=, #has_binding?
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) ⇒ Script
Returns a new instance of Script.
135 136 137 |
# File 'lib/duby/ast/structure.rb', line 135 def initialize(parent, line_number, &block) super(parent, line_number, children, &block) end |
Instance Attribute Details
#defining_class ⇒ Object
Returns the value of attribute defining_class.
133 134 135 |
# File 'lib/duby/ast/structure.rb', line 133 def defining_class @defining_class end |
Instance Method Details
#compile(compiler, expression) ⇒ Object
142 143 144 145 |
# File 'lib/duby/compiler.rb', line 142 def compile(compiler, expression) # TODO: what does it mean for a script to be an expression? possible? compiler.define_main(self) end |
#infer(typer) ⇒ Object
139 140 141 142 |
# File 'lib/duby/ast/structure.rb', line 139 def infer(typer) @defining_class ||= typer.self_type @inferred_type ||= typer.infer(body) || (typer.defer(self); nil) end |