| library; | |
| import self as self; | |
| import "dart:core" as core; | |
| import "package:expect/expect.dart" as exp; | |
| import "package:expect/expect.dart"; | |
| static const field core::int var1 = #C1; | |
| static const field core::int var2 = #C2; | |
| static const field core::int var3 = #C3; | |
| static const field core::int var4 = #C4; | |
| static const field core::int var5 = #C1; | |
| static const field core::int var6 = #C5; | |
| static const field core::int var7 = #C2; | |
| static const field core::int var8 = #C6; | |
| static const field core::int var9 = #C7; | |
| static method fn(core::int a) → core::int { | |
| core::int b = a; | |
| core::int i = 0; | |
| while (i.{core::num::<}(2){(core::num) → core::bool}) { | |
| b = b.{core::num::+}(a){(core::num) → core::int}; | |
| i = i.{core::num::+}(1){(core::num) → core::int}; | |
| } | |
| return b; | |
| } | |
| static method fn1(core::int a) → core::int { | |
| core::int b = a; | |
| while (true) { | |
| b = b.{core::num::*}(3){(core::num) → core::int}; | |
| if(b.{core::num::>}(10){(core::num) → core::bool}) | |
| return b; | |
| } | |
| } | |
| static method fnContinue() → core::int { | |
| core::int a = 0; | |
| core::int i = 0; | |
| while (i.{core::num::<}(5){(core::num) → core::bool}) | |
| #L1: | |
| { | |
| if(i.{core::num::%}(2){(core::num) → core::int} =={core::num::==}{(core::Object) → core::bool} 1) { | |
| i = i.{core::num::+}(1){(core::num) → core::int}; | |
| break #L1; | |
| } | |
| a = a.{core::num::+}(i){(core::num) → core::int}; | |
| i = i.{core::num::+}(1){(core::num) → core::int}; | |
| } | |
| return a; | |
| } | |
| static method fnBreak(core::int a) → core::int { | |
| core::int b = a; | |
| core::int i = 0; | |
| #L2: | |
| while (i.{core::num::<}(2){(core::num) → core::bool}) { | |
| if(b =={core::num::==}{(core::Object) → core::bool} 2) | |
| break #L2; | |
| b = b.{core::num::+}(a){(core::num) → core::int}; | |
| i = i.{core::num::+}(1){(core::num) → core::int}; | |
| } | |
| return b; | |
| } | |
| static method fnNestedWhile() → core::int { | |
| core::int a = 0; | |
| while (true) { | |
| #L3: | |
| while (true) { | |
| break #L3; | |
| } | |
| return 1; | |
| } | |
| } | |
| static method fnBreakLabel() → core::int { | |
| #L4: | |
| while (true) { | |
| while (true) { | |
| break #L4; | |
| } | |
| } | |
| return 3; | |
| } | |
| static method main() → void { | |
| exp::Expect::equals(#C1, 6); | |
| exp::Expect::equals(#C2, 9); | |
| exp::Expect::equals(#C3, 18); | |
| exp::Expect::equals(#C4, 27); | |
| exp::Expect::equals(#C1, 6); | |
| exp::Expect::equals(#C5, 2); | |
| exp::Expect::equals(#C2, 9); | |
| exp::Expect::equals(#C6, 1); | |
| exp::Expect::equals(#C7, 3); | |
| } | |
| constants { | |
| #C1 = 6 | |
| #C2 = 9 | |
| #C3 = 18 | |
| #C4 = 27 | |
| #C5 = 2 | |
| #C6 = 1 | |
| #C7 = 3 | |
| } |