fixing multiple evaluation of splat sources, when it's an invoked function

This commit is contained in:
Jeremy Ashkenas
2010-02-27 15:15:26 -05:00
parent afa26c37f1
commit 7d39fe1c56
2 changed files with 10 additions and 1 deletions

View File

@@ -363,6 +363,10 @@ CallNode: exports.CallNode: inherit BaseNode, {
compile_splat: (o) ->
meth: @variable.compile o
obj: @variable.source or 'this'
if obj.match(/\(/)
temp: o.scope.free_variable()
obj: temp
meth: '(' + temp + ' = ' + @variable.source + ')' + @variable.last
args: for arg, i in @args
code: arg.compile o
code: if arg instanceof SplatNode then code else '[' + code + ']'