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 authored and GitHub committed 2024-06-07 01:24:32 +00:00
1 parent 68c9f554ff
commit 479b8e5232
2 files changed
+4 -1

No files matched your search

+1 -1
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':
@@ -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) {