Class: Riml::Compiler::DictGetBracketNodeVisitor

Inherits:
Visitor
  • Object
show all
Defined in:
lib/riml/compiler.rb

Direct Known Subclasses

ListOrDictGetNodeVisitor

Instance Method Summary collapse

Methods inherited from Visitor

#initialize, #visit

Constructor Details

This class inherits a constructor from Riml::Compiler::Visitor

Instance Method Details

#compile(node) ⇒ Object



710
711
712
713
714
715
716
717
718
719
720
721
722
# File 'lib/riml/compiler.rb', line 710

def compile(node)
  node.dict.parent_node = node
  node.keys.each do |k|
    k.parent_node = node
  end
  node.dict.accept(visitor_for_node(node.dict))
  node.keys.each do |key|
    node.compiled_output << '['
    key.accept(visitor_for_node(key))
    node.compiled_output << ']'
  end
  node.compiled_output
end