Permalink
Browse files

Check inside blocks for variable declarations. Oops!

  • Loading branch information...
1 parent b69f0a6 commit 778034d358498ee05657561ad078c005c542026e @matthewd committed Jan 18, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 lib/capuchin/visitor.rb
View
@@ -41,9 +41,25 @@ def visit_VarDeclNode(o)
end
def visit_ForNode(o)
accept o.init if Capuchin::Nodes::VarStatementNode === o.init
+ accept o.value
end
def visit_ForInNode(o)
accept o.init if Capuchin::Nodes::VarStatementNode === o.init
+ accept o.value
+ end
+ def visit_IfNode(o)
+ accept o.value
+ accept o.else
+ end
+ def visit_SwitchNode(o)
+ o.value.each do |c|
+ accept c.value
+ end
+ end
+ def visit_BlockNode(o)
+ o.statements.each do |st|
+ accept st
+ end
end
def visit_VarStatementNode(o)
accept o.value

0 comments on commit 778034d

Please sign in to comment.