use t.toComputedKey in computed property name transformer

This commit is contained in:
Sebastian McKenzie
2015-01-04 07:38:49 +11:00
parent 324a0b408a
commit 55123be7d7

View File

@@ -44,7 +44,7 @@ exports.ObjectExpression = function (node, parent, file, scope) {
broken = true;
}
if (!broken || t.isLiteral(prop.key, { value: "__proto__" })) {
if (!broken || t.isLiteral(t.toComputedKey(prop, prop.key), { value: "__proto__" })) {
initProps.push(prop);
props[i] = null;
}
@@ -61,6 +61,7 @@ exports.ObjectExpression = function (node, parent, file, scope) {
var bodyNode;
if (prop.computed && t.isMemberExpression(key) && t.isIdentifier(key.object, { name: "Symbol" })) {
// { [Symbol.iterator]: "foo" }
bodyNode = t.assignmentExpression(
"=",
t.memberExpression(objId, key, true),