add initProps to single call expression in computed property names - fixes #378

This commit is contained in:
Sebastian McKenzie 2015-01-04 19:42:16 +11:00
parent 223e28ba8f
commit b5a78355c4
3 changed files with 18 additions and 1 deletions

View File

@ -80,7 +80,7 @@ exports.ObjectExpression = function (node, parent, file, scope) {
var first = body[0].expression;
if (t.isCallExpression(first)) {
first.arguments[0] = t.objectExpression([]);
first.arguments[0] = t.objectExpression(initProps);
return first;
}
}

View File

@ -0,0 +1,4 @@
var obj = {
first: "first",
["second"]: "second",
};

View File

@ -0,0 +1,13 @@
"use strict";
var _defineProperty = function (obj, key, value) {
return Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
};
var obj = _defineProperty({
first: "first" }, "second", "second");