Skip to content

Commit 47c7af9

Browse files
committed
fix(compiler-core): Refactor walkIdentifiers to handle SwitchStatement scopeIds correctly
1 parent f5f832f commit 47c7af9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/compiler-core/src/babelUtils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,12 @@ export function walkIdentifiers(
8585
} else if (node.type === 'SwitchStatement') {
8686
if (node.scopeIds) {
8787
node.scopeIds.forEach(id => markKnownIds(id, knownIds))
88+
} else {
89+
// record switch case block-level local variables
90+
walkSwitchStatement(node, false, id =>
91+
markScopeIdentifier(node, id, knownIds),
92+
)
8893
}
89-
// record switch case block-level local variables
90-
walkSwitchStatement(node, false, id =>
91-
markScopeIdentifier(node, id, knownIds),
92-
)
9394
} else if (node.type === 'CatchClause' && node.param) {
9495
for (const id of extractIdentifiers(node.param)) {
9596
markScopeIdentifier(node, id, knownIds)

0 commit comments

Comments
 (0)