| library /*isNonNullableByDefault*/; |
| import self as self; |
| import "dart:core" as core; |
| |
| static method test1(dynamic x) → dynamic { |
| return block { |
| core::String #t1; |
| final dynamic #t2 = x; |
| core::int #t3 = -1; |
| core::bool #t4 = false; |
| if(!#t4 && #t2 =={core::Object::==}{(core::Object) → core::bool} #C1) { |
| #t3 = 0; |
| #t4 = true; |
| } |
| if(!#t4) { |
| #t3 = 1; |
| #t4 = true; |
| } |
| #L1: |
| switch(#t3) { |
| #L2: |
| case #C1: |
| { |
| #t1 = "zero"; |
| break #L1; |
| } |
| #L3: |
| case #C2: |
| { |
| #t1 = "other"; |
| break #L1; |
| } |
| } |
| } =>#t1; |
| } |
| static method test2(core::String x) → dynamic { |
| return block { |
| core::int #t5; |
| final core::String #t6 = x; |
| core::int #t7 = -1; |
| core::bool #t8 = false; |
| if(!#t8 && #t6 =={core::String::==}{(core::Object) → core::bool} #C3) { |
| #t7 = 0; |
| #t8 = true; |
| } |
| if(!#t8) { |
| #t7 = 1; |
| #t8 = true; |
| } |
| #L4: |
| switch(#t7) { |
| #L5: |
| case #C1: |
| { |
| #t5 = 0; |
| break #L4; |
| } |
| #L6: |
| case #C2: |
| { |
| #t5 = 1; |
| break #L4; |
| } |
| } |
| } =>#t5; |
| } |
| static method main() → dynamic { |
| self::expectEquals(self::test1(0), "zero"); |
| self::expectEquals(self::test1(null), "other"); |
| self::expectEquals(self::test1(<dynamic>[]), "other"); |
| self::expectEquals(self::test2("zero"), 0); |
| self::expectEquals(self::test2("one"), 1); |
| self::expectEquals(self::test2("two"), 1); |
| } |
| static method expectEquals(dynamic x, dynamic y) → dynamic { |
| if(!(x =={core::Object::==}{(core::Object) → core::bool} y)) { |
| throw "Expected ${x} to be equal to ${y}."; |
| } |
| } |
| |
| constants { |
| #C1 = 0 |
| #C2 = 1 |
| #C3 = "zero" |
| } |