File tree 5 files changed +70
-0
lines changed
swc/tests/fixture/issues-9xxx/9579
swc_ecma_compat_es2015/src/block_scoping
5 files changed +70
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ swc_ecma_compat_es2015 : patch
3
+ swc_core : patch
4
+ ---
5
+
6
+ fix(es/compat): Skip ` getter ` and ` setter ` as FlowHelper ` function ` do
Original file line number Diff line number Diff line change
1
+ {
2
+ "jsc" : {
3
+ "parser" : {
4
+ "syntax" : " typescript" ,
5
+ "tsx" : true
6
+ },
7
+ "target" : " es5" ,
8
+ "loose" : false ,
9
+ "minify" : {
10
+ "compress" : false ,
11
+ "mangle" : false
12
+ }
13
+ },
14
+ "module" : {
15
+ "type" : " es6"
16
+ },
17
+ "minify" : false ,
18
+ "isModule" : true
19
+ }
Original file line number Diff line number Diff line change
1
+ function expectA ( a ) {
2
+ console . log ( a . b === 1 )
3
+ }
4
+
5
+ export function test ( ) {
6
+ // any loop
7
+ for ( let i = 0 ; i < 1 ; i ++ ) {
8
+ const a = {
9
+ get b ( ) {
10
+ return 1
11
+ }
12
+ }
13
+ const c = 2
14
+ ; ( ) => {
15
+ // create any arrow function that references value in loop
16
+ c
17
+ }
18
+ // We expect a.b to be 1
19
+ expectA ( a )
20
+ }
21
+ }
Original file line number Diff line number Diff line change
1
+ function expectA ( a ) {
2
+ console . log ( a . b === 1 ) ;
3
+ }
4
+ export function test ( ) {
5
+ var _loop = function ( i ) {
6
+ var a = {
7
+ get b ( ) {
8
+ return 1 ;
9
+ }
10
+ } ;
11
+ var c = 2 ;
12
+ ( function ( ) {
13
+ c ;
14
+ } ) ;
15
+ expectA ( a ) ;
16
+ } ;
17
+ for ( var i = 0 ; i < 1 ; i ++ ) _loop ( i ) ;
18
+ }
Original file line number Diff line number Diff line change @@ -750,6 +750,12 @@ impl VisitMut for FlowHelper<'_> {
750
750
/// noop
751
751
fn visit_mut_function ( & mut self , _f : & mut Function ) { }
752
752
753
+ /// noop
754
+ fn visit_mut_getter_prop ( & mut self , _f : & mut GetterProp ) { }
755
+
756
+ /// noop
757
+ fn visit_mut_setter_prop ( & mut self , _f : & mut SetterProp ) { }
758
+
753
759
fn visit_mut_labeled_stmt ( & mut self , l : & mut LabeledStmt ) {
754
760
self . inner_label . insert ( l. label . sym . clone ( ) ) ;
755
761
You can’t perform that action at this time.
0 commit comments