Merge pull request #83 from thejameskyle/context-computed-spread-fix

Fix for spread on computed context
This commit is contained in:
Sebastian McKenzie
2014-10-19 11:11:54 +11:00
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));