Skip to content

Commit

Permalink
repl: fix await object patterns without values
Browse files Browse the repository at this point in the history
fix lint issue

PR-URL: #53331
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Kohei Ueno <[email protected]>
  • Loading branch information
lukehaas authored and marco-ippolito committed Jul 19, 2024
1 parent 04d78dd commit 092aa09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/repl/await.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const visitorsWithoutAncestors = {
break;
case 'ObjectPattern':
ArrayPrototypeForEach(node.properties, (property) => {
registerVariableDeclarationIdentifiers(property.value);
registerVariableDeclarationIdentifiers(property.value || property.argument);
});
break;
case 'ArrayPattern':
Expand Down
3 changes: 3 additions & 0 deletions test/parallel/test-repl-preprocess-top-level-await.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ const testCases = [
'(async () => { return { value: ((await x).y) } })()'],
[ 'await (await x).y',
'(async () => { return { value: (await (await x).y) } })()'],
[ 'var { ...rest } = await {}',
'var rest; (async () => { void ({ ...rest } = await {}) })()',
],
];

for (const [input, expected] of testCases) {
Expand Down

0 comments on commit 092aa09

Please sign in to comment.