Class: Johnson::Visitors::Visitor

Inherits:
Object
  • Object
show all
Defined in:
lib/johnson/visitors/visitor.rb

Direct Known Subclasses

EnumeratingVisitor

Instance Method Summary collapse

Instance Method Details

#accept(target) ⇒ Object



86
87
88
# File 'lib/johnson/visitors/visitor.rb', line 86

def accept(target)
  target.accept(self)
end

#visit_For(o) ⇒ Object



29
30
31
32
33
34
# File 'lib/johnson/visitors/visitor.rb', line 29

def visit_For(o)
  o.init && o.init.accept(self)
  o.cond && o.cond.accept(self)
  o.update && o.update.accept(self)
  o.body.accept(self)
end

#visit_ForIn(o) ⇒ Object



36
37
38
39
# File 'lib/johnson/visitors/visitor.rb', line 36

def visit_ForIn(o)
  o.in_cond.accept(self)
  o.body.accept(self)
end

#visit_Function(o) ⇒ Object

FUNCTION NODES ###



66
67
68
# File 'lib/johnson/visitors/visitor.rb', line 66

def visit_Function(o)
  o.body.accept(self)
end

#visit_LexicalScope(o) ⇒ Object



8
9
10
# File 'lib/johnson/visitors/visitor.rb', line 8

def visit_LexicalScope(o)
  o.right.accept(self)
end

#visit_SourceElements(o) ⇒ Object



4
5
6
# File 'lib/johnson/visitors/visitor.rb', line 4

def visit_SourceElements(o)
  o.value.each { |x| x.accept(self) }
end

#visit_Try(o) ⇒ Object



41
42
43
44
45
# File 'lib/johnson/visitors/visitor.rb', line 41

def visit_Try(o)
  o.cond.accept(self)
  o.b_then && o.b_then.map { |x| x.accept(self) }
  o.b_else && o.b_else.accept(self)
end