# File lib/rkelly/visitors/dot_visitor.rb, line 24 def initialize @stack = [] @node_index = 0 @nodes = [] @arrows = [] end
# File lib/rkelly/visitors/dot_visitor.rb, line 174 def visit_BracketAccessorNode(o) node = Node.new(@node_index += 1, ['BracketAccessorNode']) add_arrow_for(node) @nodes << node @stack.push(node) [:value, :accessor].each do |method| o.send(method) && o.send(method).accept(self) end @stack.pop end
# File lib/rkelly/visitors/dot_visitor.rb, line 210 def visit_DotAccessorNode(o) node = Node.new(@node_index += 1, ['DotAccessorNode', o.accessor]) add_arrow_for(node) @nodes << node @stack.push(node) [:value].each do |method| o.send(method) && o.send(method).accept(self) end @stack.pop end
# File lib/rkelly/visitors/dot_visitor.rb, line 152 def visit_ForInNode(o) node = Node.new(@node_index += 1, ['ForInNode']) add_arrow_for(node) @nodes << node @stack.push(node) [:left, :right, :value].each do |method| o.send(method) && o.send(method).accept(self) end @stack.pop end
# File lib/rkelly/visitors/dot_visitor.rb, line 128 def visit_ForNode(o) node = Node.new(@node_index += 1, ['ForNode']) add_arrow_for(node) @nodes << node @stack.push(node) [:init, :test, :counter, :value].each do |method| o.send(method) && o.send(method).accept(self) end @stack.pop end
# File lib/rkelly/visitors/dot_visitor.rb, line 163 def visit_TryNode(o) node = Node.new(@node_index += 1, ['TryNode', o.catch_var || 'NULL']) add_arrow_for(node) @nodes << node @stack.push(node) [:value, :catch_block, :finally_block].each do |method| o.send(method) && o.send(method).accept(self) end @stack.pop end
# File lib/rkelly/visitors/dot_visitor.rb, line 222 def add_arrow_for(node, label = nil) @arrows << Arrow.new(@stack.last, node, label) if @stack.length > 0 end