Modified: trunk/jparsetree/lib/jparsetree.rb (1121 => 1122)
--- trunk/jparsetree/lib/jparsetree.rb 2008-08-18 06:10:46 UTC (rev 1121)
+++ trunk/jparsetree/lib/jparsetree.rb 2008-08-18 06:10:48 UTC (rev 1122)
@@ -365,8 +365,8 @@
def visitBeginNode(iVisited)
visit(iVisited.body_node)
- bl = JParseTree.filter_nested_arrays(@stackElements.pop)
- @stackElements << location([:begin, bl], iVisited)
+# bl = JParseTree.filter_nested_arrays(@stackElements.pop)
+# @stackElements << location([:begin, bl], iVisited)
nil
end
@@ -537,11 +537,19 @@
visit(iVisited.value_node)
val = JParseTree.filter_nested_arrays(@stackElements.pop)
- if val == nil
- @stackElements << location([:dasgn_curr, iVisited.name.to_sym], iVisited)
+ if iVisited.depth == 0
+ if val
+ @stackElements << location([:dasgn_curr, iVisited.name.to_sym, val], iVisited)
+ else
+ @stackElements << location([:dasgn_curr, iVisited.name.to_sym], iVisited)
+ end
# @stackElements << [:lasgn, iVisited.name.to_sym]
else
- @stackElements << location([:dasgn, iVisited.name.to_sym, JParseTree.filter_nested_arrays(val)], iVisited)
+ if val
+ @stackElements << location([:dasgn, iVisited.name.to_sym, val], iVisited)
+ else
+ @stackElements << location([:dasgn, iVisited.name.to_sym], iVisited)
+ end
end
nil
end
@@ -1184,7 +1192,7 @@
visit(iVisited.opt_rescue_node)
rescue_node = @stackElements.pop
if body == nil && rescue_node == nil
- @stackElements << location([:resbody, excNodes], iVisited)
+ @stackElements << location([:resbody, excNodes, [:nil]], iVisited)
else if rescue_node == nil
if body == :nil
@stackElements << location([:resbody, excNodes, [body]], iVisited)
@@ -1323,8 +1331,11 @@
cond = @stackElements.pop
visit(iVisited.body_node)
body = JParseTree.filter_nested_arrays(@stackElements.pop)
- # TODO: ask about the last element "true"
- @stackElements << location([:until, cond, body, false], iVisited)
+ if cond[0] == :not
+ @stackElements << location([:while, cond[1], body, iVisited.evaluateAtStart], iVisited)
+ else
+ @stackElements << location([:until, cond, body, iVisited.evaluateAtStart], iVisited)
+ end
nil
end
@@ -1388,7 +1399,11 @@
end
visit(iVisited.body_node)
body = JParseTree.filter_nested_arrays(@stackElements.pop)
- @stackElements << location([:while, condNode, body, iVisited.evaluateAtStart], iVisited)
+ if condNode[0] == :not
+ @stackElements << location([:until, condNode[1], body, iVisited.evaluateAtStart], iVisited)
+ else
+ @stackElements << location([:while, condNode, body, iVisited.evaluateAtStart], iVisited)
+ end
nil
end