mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Fixed #669: Wrapper arguments
This commit is contained in:
14
lib/nodes.js
14
lib/nodes.js
@@ -523,7 +523,7 @@
|
||||
return "" + (this.superReference(o)) + ".call(this" + (args.length ? ', ' : '') + (args) + ")";
|
||||
};
|
||||
CallNode.prototype.compileSplat = function(o) {
|
||||
var meth, obj, temp;
|
||||
var _b, _c, _d, mentionsArgs, meth, obj, temp;
|
||||
meth = this.meth || this.superReference(o);
|
||||
obj = this.variable && this.variable.source || 'this';
|
||||
if (obj.match(/\(/)) {
|
||||
@@ -532,8 +532,18 @@
|
||||
meth = ("(" + (temp) + " = " + (this.variable.source) + ")" + (this.variable.last));
|
||||
}
|
||||
if (this.isNew) {
|
||||
mentionsArgs = false;
|
||||
_c = this.args;
|
||||
for (_b = 0, _d = _c.length; _b < _d; _b++) {
|
||||
(function() {
|
||||
var arg = _c[_b];
|
||||
return arg.contains(function(n) {
|
||||
return mentionsArgs || (mentionsArgs = (n instanceof LiteralNode && (n.value === 'arguments')));
|
||||
});
|
||||
})();
|
||||
}
|
||||
utility('extends');
|
||||
return "" + (this.first) + "(function() {\n" + (this.idt(1)) + "var ctor = function(){};\n" + (this.idt(1)) + "__extends(ctor, " + (meth) + ");\n" + (this.idt(1)) + "return " + (meth) + ".apply(new ctor, " + (this.compileSplatArguments(o)) + ");\n" + (this.tab) + "}).call(this)" + (this.last);
|
||||
return "" + (this.first) + "(function() {\n" + (this.idt(1)) + "var ctor = function(){};\n" + (this.idt(1)) + "__extends(ctor, " + (meth) + ");\n" + (this.idt(1)) + "return " + (meth) + ".apply(new ctor, " + (this.compileSplatArguments(o)) + ");\n" + (this.tab) + "})." + (mentionsArgs ? 'apply(this, arguments)' : 'call(this)') + (this.last);
|
||||
} else {
|
||||
return "" + (this.first) + (this.prefix()) + (meth) + ".apply(" + (obj) + ", " + (this.compileSplatArguments(o)) + ")" + (this.last);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user