File tree Expand file tree Collapse file tree 3 files changed +66
-5
lines changed
tests/fixtures/oxc/js/try-catch Expand file tree Collapse file tree 3 files changed +66
-5
lines changed Original file line number Diff line number Diff line change @@ -71,11 +71,6 @@ impl<'a> Binder<'a> for VariableDeclarator<'a> {
7171 builder. add_redeclare_variable ( symbol_id, includes, span) ;
7272 declared_symbol_id = Some ( symbol_id) ;
7373
74- // remove current scope binding and add to target scope
75- // avoid same symbols appear in multi-scopes
76- builder. scoping . remove_binding ( scope_id, & name) ;
77- builder. scoping . add_binding ( target_scope_id, & name, symbol_id) ;
78- builder. scoping . symbol_scope_ids [ symbol_id] = target_scope_id;
7974 break ;
8075 }
8176 }
Original file line number Diff line number Diff line change 1+ var a = 1 ;
2+ try {
3+ throw 2
4+ } catch ( a ) {
5+ var a = 3 ;
6+ }
7+ console . log ( a ) ;
Original file line number Diff line number Diff line change 1+ -- -
2+ source : crates / oxc_semantic / tests / main .rs
3+ input_file : crates / oxc_semantic / tests / fixtures / oxc / js / try - catch / with - same - name - var .js
4+ -- -
5+ [
6+ {
7+ " children" : [
8+ {
9+ " children" : [],
10+ " flags" : " ScopeFlags(StrictMode)" ,
11+ " id" : 1 ,
12+ " node" : " BlockStatement" ,
13+ " symbols" : []
14+ },
15+ {
16+ " children" : [
17+ {
18+ " children" : [],
19+ " flags" : " ScopeFlags(StrictMode)" ,
20+ " id" : 3 ,
21+ " node" : " BlockStatement" ,
22+ " symbols" : [
23+ {
24+ " flags" : " SymbolFlags(FunctionScopedVariable | CatchVariable)" ,
25+ " id" : 1 ,
26+ " name" : " a" ,
27+ " node" : " CatchParameter" ,
28+ " references" : []
29+ }
30+ ]
31+ }
32+ ],
33+ " flags" : " ScopeFlags(StrictMode | CatchClause)" ,
34+ " id" : 2 ,
35+ " node" : " CatchClause" ,
36+ " symbols" : []
37+ }
38+ ],
39+ " flags" : " ScopeFlags(StrictMode | Top)" ,
40+ " id" : 0 ,
41+ " node" : " Program" ,
42+ " symbols" : [
43+ {
44+ " flags" : " SymbolFlags(FunctionScopedVariable)" ,
45+ " id" : 0 ,
46+ " name" : " a" ,
47+ " node" : " VariableDeclarator(a)" ,
48+ " references" : [
49+ {
50+ " flags" : " ReferenceFlags(Read)" ,
51+ " id" : 1 ,
52+ " name" : " a" ,
53+ " node_id" : 23
54+ }
55+ ]
56+ }
57+ ]
58+ }
59+ ]
You can’t perform that action at this time.
0 commit comments