fix(reactivity-transform): should not rewrite catch param (#5711)

fix #5709
This commit is contained in:
edison
2022-04-14 08:06:58 +08:00
committed by GitHub
parent 86858a9582
commit 1f14f19439
3 changed files with 21 additions and 0 deletions

View File

@@ -566,6 +566,16 @@ export function transformAST(
return
}
// catch param
if (node.type === 'CatchClause') {
scopeStack.push((currentScope = {}))
if (node.param && node.param.type === 'Identifier') {
registerBinding(node.param)
}
walkScope(node.body)
return
}
// non-function block scopes
if (node.type === 'BlockStatement' && !isFunctionType(parent!)) {
scopeStack.push((currentScope = {}))