mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Fixes #2367 -- super in for-loop
This commit is contained in:
@@ -2747,7 +2747,7 @@
|
||||
};
|
||||
|
||||
For.prototype.pluckDirectCall = function(o, body) {
|
||||
var base, defs, expr, fn, idx, ref, val, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
|
||||
var base, defs, expr, fn, idx, ref, val, _i, _len, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8;
|
||||
defs = [];
|
||||
_ref2 = body.expressions;
|
||||
for (idx = _i = 0, _len = _ref2.length; _i < _len; idx = ++_i) {
|
||||
@@ -2756,15 +2756,15 @@
|
||||
if (!(expr instanceof Call)) {
|
||||
continue;
|
||||
}
|
||||
val = expr.variable.unwrapAll();
|
||||
if (!((val instanceof Code) || (val instanceof Value && ((_ref3 = val.base) != null ? _ref3.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref4 = (_ref5 = val.properties[0].name) != null ? _ref5.value : void 0) === 'call' || _ref4 === 'apply')))) {
|
||||
val = (_ref3 = expr.variable) != null ? _ref3.unwrapAll() : void 0;
|
||||
if (!((val instanceof Code) || (val instanceof Value && ((_ref4 = val.base) != null ? _ref4.unwrapAll() : void 0) instanceof Code && val.properties.length === 1 && ((_ref5 = (_ref6 = val.properties[0].name) != null ? _ref6.value : void 0) === 'call' || _ref5 === 'apply')))) {
|
||||
continue;
|
||||
}
|
||||
fn = ((_ref6 = val.base) != null ? _ref6.unwrapAll() : void 0) || val;
|
||||
fn = ((_ref7 = val.base) != null ? _ref7.unwrapAll() : void 0) || val;
|
||||
ref = new Literal(o.scope.freeVariable('fn'));
|
||||
base = new Value(ref);
|
||||
if (val.base) {
|
||||
_ref7 = [base, val], val.base = _ref7[0], base = _ref7[1];
|
||||
_ref8 = [base, val], val.base = _ref8[0], base = _ref8[1];
|
||||
}
|
||||
body.expressions[idx] = new Call(base, expr.args);
|
||||
defs = defs.concat(this.makeCode(this.tab), new Assign(ref, fn).compileToFragments(o, LEVEL_TOP), this.makeCode(';\n'));
|
||||
|
||||
Reference in New Issue
Block a user