File tree 5 files changed +97
-0
lines changed
5 files changed +97
-0
lines changed Original file line number Diff line number Diff line change @@ -521,6 +521,7 @@ export class Flow {
521
521
522
522
/** Inherits categorical flags as conditional flags from the specified flow (e.g. then without else). */
523
523
inheritConditional ( other : Flow ) : void {
524
+ this . set ( other . flags & FlowFlags . ANY_CONDITIONAL ) ;
524
525
if ( other . is ( FlowFlags . RETURNS ) ) {
525
526
this . set ( FlowFlags . CONDITIONALLY_RETURNS ) ;
526
527
}
@@ -539,6 +540,7 @@ export class Flow {
539
540
var localFlags = other . localFlags ;
540
541
for ( let i = 0 , k = localFlags . length ; i < k ; ++ i ) {
541
542
let flags = localFlags [ i ] ;
543
+ this . setLocalFlag ( i , flags & LocalFlags . ANY_CONDITIONAL ) ;
542
544
if ( flags & LocalFlags . RETAINED ) this . setLocalFlag ( i , LocalFlags . CONDITIONALLY_RETAINED ) ;
543
545
if ( flags & LocalFlags . READFROM ) this . setLocalFlag ( i , LocalFlags . CONDITIONALLY_READFROM ) ;
544
546
if ( flags & LocalFlags . WRITTENTO ) this . setLocalFlag ( i , LocalFlags . CONDITIONALLY_WRITTENTO ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "asc_flags" : [
3
+ " --runtime none"
4
+ ]
5
+ }
Original file line number Diff line number Diff line change
1
+ (module
2
+ (type $FUNCSIG$vi (func (param i32 )))
3
+ (type $FUNCSIG$v (func ))
4
+ (memory $0 0 )
5
+ (export " memory" (memory $0 ))
6
+ (export " testInherit" (func $continue/testInherit ))
7
+ (func $continue/testInherit (; 0 ;) (type $FUNCSIG$vi ) (param $0 i32 )
8
+ (local $1 i32 )
9
+ block $break|0
10
+ loop $loop|0
11
+ local.get $1
12
+ i32.const 10
13
+ i32.ge_s
14
+ br_if $break|0
15
+ block $continue|0
16
+ local.get $0
17
+ i32.const 0
18
+ local.get $1
19
+ i32.const 5
20
+ i32.eq
21
+ select
22
+ br_if $continue|0
23
+ end
24
+ local.get $1
25
+ i32.const 1
26
+ i32.add
27
+ local.set $1
28
+ br $loop|0
29
+ end
30
+ unreachable
31
+ end
32
+ )
33
+ (func $null (; 1 ;) (type $FUNCSIG$v )
34
+ nop
35
+ )
36
+ )
Original file line number Diff line number Diff line change
1
+ // see https://github.com/AssemblyScript/assemblyscript/issues/813
2
+ export function testInherit ( b : bool ) : void {
3
+ for ( let i = 0 ; i < 10 ; i ++ ) {
4
+ if ( b ) {
5
+ if ( i == 5 ) {
6
+ continue ;
7
+ }
8
+ // inheritConditional
9
+ }
10
+ // yielding a continue block
11
+ }
12
+ }
Original file line number Diff line number Diff line change
1
+ (module
2
+ (type $FUNCSIG$vi (func (param i32 )))
3
+ (type $FUNCSIG$v (func ))
4
+ (memory $0 0 )
5
+ (table $0 1 funcref )
6
+ (elem (i32.const 0 ) $null )
7
+ (export " memory" (memory $0 ))
8
+ (export " testInherit" (func $continue/testInherit ))
9
+ (func $continue/testInherit (; 0 ;) (type $FUNCSIG$vi ) (param $0 i32 )
10
+ (local $1 i32 )
11
+ block $break|0
12
+ i32.const 0
13
+ local.set $1
14
+ loop $loop|0
15
+ local.get $1
16
+ i32.const 10
17
+ i32.lt_s
18
+ i32.eqz
19
+ br_if $break|0
20
+ block $continue|0
21
+ local.get $0
22
+ if
23
+ local.get $1
24
+ i32.const 5
25
+ i32.eq
26
+ if
27
+ br $continue|0
28
+ end
29
+ end
30
+ end
31
+ local.get $1
32
+ i32.const 1
33
+ i32.add
34
+ local.set $1
35
+ br $loop|0
36
+ end
37
+ unreachable
38
+ end
39
+ )
40
+ (func $null (; 1 ;) (type $FUNCSIG$v )
41
+ )
42
+ )
You can’t perform that action at this time.
0 commit comments