Skip to content

Commit 092aa09

Browse files
lukehaasmarco-ippolito
authored andcommitted
repl: fix await object patterns without values
fix lint issue PR-URL: #53331 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Kohei Ueno <[email protected]>
1 parent 04d78dd commit 092aa09

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/internal/repl/await.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const visitorsWithoutAncestors = {
104104
break;
105105
case 'ObjectPattern':
106106
ArrayPrototypeForEach(node.properties, (property) => {
107-
registerVariableDeclarationIdentifiers(property.value);
107+
registerVariableDeclarationIdentifiers(property.value || property.argument);
108108
});
109109
break;
110110
case 'ArrayPattern':

test/parallel/test-repl-preprocess-top-level-await.js

+3
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ const testCases = [
144144
'(async () => { return { value: ((await x).y) } })()'],
145145
[ 'await (await x).y',
146146
'(async () => { return { value: (await (await x).y) } })()'],
147+
[ 'var { ...rest } = await {}',
148+
'var rest; (async () => { void ({ ...rest } = await {}) })()',
149+
],
147150
];
148151

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

0 commit comments

Comments
 (0)