Skip to content

Commit

Permalink
Allow bjects with single string literal keys in tail position
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohnson committed Oct 8, 2017
1 parent c69f7e9 commit 0ec702c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/transforms/comprehension.lsc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ transformObjectComprehensionTails(loopPath, id): void ->
// Simple object case: { [k]: v } --> obj[k] = v
{ properties: [prop] } = expr
t.assignmentExpression("=",
t.memberExpression(id, prop.key, prop.computed)~atNode(expr),
t.memberExpression(id, prop.key, prop.computed or (not prop.key~isa("Identifier")))~atNode(expr),
prop.value
)~atNode(expr)
else:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
obj = {...for const x of []: {'a': 1}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const obj = (() => {
const _obj = {};for (const x of []) _obj['a'] = 1;return _obj;
})();

0 comments on commit 0ec702c

Please sign in to comment.