Skip to content

Commit

Permalink
Rewrite :incr internal operator into += method call
Browse files Browse the repository at this point in the history
  • Loading branch information
vidarh committed Sep 23, 2014
1 parent c288585 commit b3edea5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions treeoutput.rb
Expand Up @@ -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
Expand Down

0 comments on commit b3edea5

Please sign in to comment.