Skip to content

Commit e66eb37

Browse files
lukehaasRafaelGSS
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 0ecb770 commit e66eb37

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/internal/repl/await.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 0 deletions
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)