Fix for spread on computed context

This commit is contained in:
James Kyle
2014-10-18 17:07:23 -07:00
parent 88856e040d
commit 9c784436f0
5 changed files with 16 additions and 1 deletions

View File

@@ -56,7 +56,14 @@ exports.CallExpression = function (node, parent, file) {
if (callee.type === "MemberExpression") {
contextLiteral = callee.object;
callee.property = b.memberExpression(callee.property, b.identifier("apply"), false);
if (callee.computed) {
callee.object = b.memberExpression(callee.object, callee.property, true);
callee.property = b.identifier("apply");
callee.computed = false;
} else {
callee.property = b.memberExpression(callee.property, b.identifier("apply"), false);
}
} else {
node.callee = b.memberExpression(node.callee, b.identifier("apply"), false);
}

View File

@@ -0,0 +1 @@
obj[method](foo, bar, ...args);

View File

@@ -0,0 +1,3 @@
"use strict";
var _slice = Array.prototype.slice;
obj[method].apply(obj, [foo, bar].concat(_slice.call(args)));

View File

@@ -0,0 +1 @@
obj[method](...args);

View File

@@ -0,0 +1,3 @@
"use strict";
var _slice = Array.prototype.slice;
obj[method].apply(obj, _slice.call(args));