File tree 4 files changed +53
-1
lines changed
swc/tests/exec/issues-9xxx/9110
swc_ecma_compat_es2015/src
4 files changed +53
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ swc_core : patch
3
+ swc_ecma_compat_es2015 : patch
4
+ ---
5
+
6
+ fix(es/generator): Fix code generation for ` break ` in nested while
Original file line number Diff line number Diff line change
1
+ {
2
+ "jsc" : {
3
+ "parser" : {
4
+ "syntax" : " ecmascript"
5
+ },
6
+ "externalHelpers" : false ,
7
+ "target" : " es5"
8
+ },
9
+ "isModule" : true
10
+ }
Original file line number Diff line number Diff line change
1
+ function * test ( ) {
2
+ while ( ! False ( ) ) {
3
+ // execute this line
4
+ while ( ! False ( ) ) {
5
+ // execute this line
6
+ break ;
7
+ }
8
+ // execute this line
9
+ if ( False ( ) ) {
10
+ // NOT execute this line
11
+ break ;
12
+ }
13
+
14
+ // execute this line
15
+ yield "correct" ;
16
+ return ;
17
+ }
18
+
19
+ // NOT execute this line
20
+ yield "wrong" ;
21
+ return ;
22
+ }
23
+
24
+ function False ( ) {
25
+ return false ;
26
+ }
27
+
28
+ const t = test ( ) ;
29
+ expect ( t . next ( ) ) . toEqual ( {
30
+ value : "correct" ,
31
+ done : false ,
32
+ } ) ;
33
+ expect ( t . next ( ) ) . toEqual ( {
34
+ value : undefined ,
35
+ done : true ,
36
+ } ) ;
Original file line number Diff line number Diff line change @@ -1659,7 +1659,7 @@ impl Generator {
1659
1659
self . emit_break ( loop_label, None ) ;
1660
1660
self . end_loop_block ( ) ;
1661
1661
} else {
1662
- node. visit_mut_children_with ( self ) ;
1662
+ node. visit_mut_with ( self ) ;
1663
1663
1664
1664
self . emit_stmt ( node. into ( ) ) ;
1665
1665
}
You can’t perform that action at this time.
0 commit comments