Permalink
Browse files

Rewrite :incr internal operator into += method call

  • Loading branch information...
vidarh committed Sep 23, 2014
1 parent c288585 commit b3edea54b8a4e309c5e69db752762e9f72d5ff00
Showing with 6 additions and 0 deletions.
  1. +6 −0 treeoutput.rb
View
@@ -67,6 +67,12 @@ def oper(o)
else
@vstack << E[:callm, leftv, :[], [rightv]]
end
elsif o.sym == :incr
if ra and rightv[0] == :array
@vstack << E[:assign, leftv, [:callm, leftv, :"+", flatten(rightv[1..-1])]]
else
@vstack << E[:assign, leftv, [:callm, leftv, :"+", [rightv]]]
end
elsif ra and rightv[0] == :comma and o.sym == :array || o.sym == :hash
@vstack << E[o.sym, leftv].compact + flatten(rightv)
elsif ra and rightv[0] == :comma and o.sym != :comma

0 comments on commit b3edea5

Please sign in to comment.