fixing multiple evaluation of splat sources, when it's an invoked function
This commit is contained in:
parent
afa26c37f1
commit
7d39fe1c56
|
@ -472,9 +472,14 @@
|
|||
},
|
||||
// Compile a function call being passed variable arguments.
|
||||
compile_splat: function compile_splat(o) {
|
||||
var _a, _b, _c, arg, args, code, i, meth, obj;
|
||||
var _a, _b, _c, arg, args, code, i, meth, obj, temp;
|
||||
meth = this.variable.compile(o);
|
||||
obj = this.variable.source || 'this';
|
||||
if (obj.match(/\(/)) {
|
||||
temp = o.scope.free_variable();
|
||||
obj = temp;
|
||||
meth = '(' + temp + ' = ' + this.variable.source + ')' + this.variable.last;
|
||||
}
|
||||
args = (function() {
|
||||
_a = []; _b = this.args;
|
||||
for (i = 0, _c = _b.length; i < _c; i++) {
|
||||
|
|
|
@ -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 + ']'
|
||||
|
|
Loading…
Reference in New Issue