Skip to content

Commit 215d369

Browse files
authored
Merge pull request #2 from aapokiiso/addition-shorthand-dynamic-prop
Use dynamic property access with addition shorthand
2 parents ca1e7ea + f27affa commit 215d369

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ module.exports = function (babel) {
200200
// object[property] += right -> (x = object, y = property, x[y] = x[y] + right)
201201
path.replaceWith(types.sequenceExpression([
202202
types.assignmentExpression('=', x, left.object),
203-
types.assignmentExpression('=', y, left.property),
204-
types.assignmentExpression('=', types.memberExpression(x, y), types.callExpression(types.memberExpression(types.identifier(JSBI), types.identifier(functionName)), [types.memberExpression(x, y), right]))
203+
types.assignmentExpression('=', y, types.StringLiteral(left.property.name)),
204+
types.assignmentExpression('=', types.memberExpression(x, y, true), types.callExpression(types.memberExpression(types.identifier(JSBI), types.identifier(functionName)), [types.memberExpression(x, y, true), right]))
205205
]));
206206
} else {
207207
// left += right -> (left = left + right)

0 commit comments

Comments
 (0)