repl: fix await object patterns without values

fix lint issue

PR-URL: https://github.com/nodejs/node/pull/53331
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
This commit is contained in:
Luke Haas 2024-06-07 02:24:32 +01:00 committed by GitHub
parent 68c9f554ff
commit 479b8e5232
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -104,7 +104,7 @@ const visitorsWithoutAncestors = {
break;
case 'ObjectPattern':
ArrayPrototypeForEach(node.properties, (property) => {
registerVariableDeclarationIdentifiers(property.value);
registerVariableDeclarationIdentifiers(property.value || property.argument);
});
break;
case 'ArrayPattern':

View File

@ -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) {