Class: TypeProf::Core::AST::ForNode
- Defined in:
- lib/typeprof/core/ast/misc.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#expr ⇒ Object
readonly
Returns the value of attribute expr.
Attributes inherited from Node
#changes, #lenv, #prev_node, #ret, #static_ret
Instance Method Summary collapse
-
#initialize(raw_node, lenv) ⇒ ForNode
constructor
A new instance of ForNode.
- #install0(genv) ⇒ Object
- #subnodes ⇒ Object
Methods inherited from Node
#attrs, #boxes, #code_range, #define, #define0, #define_copy, #diagnostics, #diff, #each_subnode, #get_vertexes, #install, #install_copy, #modified_vars, #pretty_print_instance_variables, #retrieve_at, #traverse, #undefine, #undefine0, #uninstall
Constructor Details
#initialize(raw_node, lenv) ⇒ ForNode
Returns a new instance of ForNode.
190 191 192 193 194 195 196 |
# File 'lib/typeprof/core/ast/misc.rb', line 190 def initialize(raw_node, lenv) super(raw_node, lenv) # XXX: tentative implementation # raw_node.index @expr = AST.create_node(raw_node.collection, lenv) @body = raw_node.statements ? AST.create_node(raw_node.statements, lenv) : DummyNilNode.new(TypeProf::CodeRange.new(code_range.last, code_range.last), lenv) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
198 199 200 |
# File 'lib/typeprof/core/ast/misc.rb', line 198 def body @body end |
#expr ⇒ Object (readonly)
Returns the value of attribute expr.
198 199 200 |
# File 'lib/typeprof/core/ast/misc.rb', line 198 def expr @expr end |
Instance Method Details
#install0(genv) ⇒ Object
202 203 204 205 206 |
# File 'lib/typeprof/core/ast/misc.rb', line 202 def install0(genv) @expr.install(genv) @body.install(genv) Source.new(genv.nil_type) end |
#subnodes ⇒ Object
200 |
# File 'lib/typeprof/core/ast/misc.rb', line 200 def subnodes = { expr:, body: } |