Class: Riml::Compiler::EstablishScopeVisitor
- Inherits:
-
DrillDownVisitor
- Object
- Visitor
- DrillDownVisitor
- Riml::Compiler::EstablishScopeVisitor
- Defined in:
- lib/riml/compiler.rb
Instance Method Summary collapse
- #establish_scope(node) ⇒ Object
-
#initialize(options) ⇒ EstablishScopeVisitor
constructor
A new instance of EstablishScopeVisitor.
- #visit(node) ⇒ Object
Methods inherited from DrillDownVisitor
Constructor Details
#initialize(options) ⇒ EstablishScopeVisitor
Returns a new instance of EstablishScopeVisitor.
522 523 524 525 |
# File 'lib/riml/compiler.rb', line 522 def initialize() @scope = [:scope] @nested_function = [:nested_function] end |
Instance Method Details
#establish_scope(node) ⇒ Object
531 532 533 534 535 536 537 538 539 540 |
# File 'lib/riml/compiler.rb', line 531 def establish_scope(node) if node.scope && !@nested_function node.scope = node.scope.merge @scope elsif node.scope node.scope = @scope.merge_parent_function(node.scope) else node.scope = @scope end walk_node!(node) end |
#visit(node) ⇒ Object
527 528 529 |
# File 'lib/riml/compiler.rb', line 527 def visit(node) establish_scope(node) end |