Skip to content

Commit 27d48c6

Browse files
authored
fix: catch clause scope (#11209)
1 parent d51075c commit 27d48c6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

packages/svelte/src/compiler/phases/scope.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ export function create_scopes(ast, root, allow_reactive_declarations, parent) {
506506
scopes.set(node, scope);
507507

508508
for (const id of extract_identifiers(node.param)) {
509-
state.scope.declare(id, 'normal', 'let');
509+
scope.declare(id, 'normal', 'let');
510510
}
511511

512512
next({ scope });
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<script>
2+
function test() {
3+
try {
4+
throw new TypeError("oops1");
5+
} catch (error) {
6+
console.log(error);
7+
}
8+
9+
try {
10+
throw new TypeError("oops2");
11+
} catch (error) {
12+
console.log(error);
13+
}
14+
}
15+
test();
16+
</script>

0 commit comments

Comments
 (0)