| library; |
| import self as self; |
| import "dart:core" as core; |
| |
| static method test1(dynamic x) → dynamic { |
| #L1: |
| { |
| core::int #t1 = 1.{core::int::unary-}(){() → core::int}; |
| final synthesized dynamic #0#0 = x; |
| #L2: |
| { |
| { |
| hoisted core::int y; |
| if(#0#0 is core::int && (let final dynamic #t2 = y = #0#0{core::int} in true)) { |
| { |
| #t1 = 0; |
| break #L2; |
| } |
| } |
| } |
| { |
| if(#C1 =={core::String::==}{(core::Object) → core::bool} #0#0 || #C2 =={core::String::==}{(core::Object) → core::bool} #0#0) { |
| #t1 = 0; |
| break #L2; |
| } |
| } |
| { |
| hoisted core::double y; |
| if(#0#0 is core::double && (let final dynamic #t3 = y = #0#0{core::double} in true)) { |
| { |
| #t1 = 0; |
| break #L2; |
| } |
| } |
| } |
| { |
| hoisted core::String y; |
| if(#0#0 is core::String && (let final dynamic #t4 = y = #0#0{core::String} in true)) { |
| { |
| #t1 = 0; |
| break #L2; |
| } |
| } |
| } |
| { |
| { |
| { |
| return 1; |
| } |
| } |
| } |
| } |
| switch(#t1) /* dynamic */ { |
| #L3: |
| case #C3: |
| { |
| { |
| return 0; |
| } |
| } |
| } |
| } |
| } |
| static method test2(dynamic x) → dynamic { |
| #L4: |
| { |
| core::int #t5 = 1.{core::int::unary-}(){() → core::int}; |
| hoisted core::double y; |
| hoisted core::List<dynamic> y2; |
| final synthesized dynamic #0#0 = x; |
| #L5: |
| { |
| { |
| hoisted core::String y; |
| if(#0#0 is core::String && (let final dynamic #t6 = y = #0#0{core::String} in true)) { |
| { |
| return "String"; |
| } |
| } |
| } |
| { |
| hoisted core::int y; |
| if(#0#0 is core::int && (let final dynamic #t7 = y = #0#0{core::int} in true)) { |
| { |
| #t5 = 0; |
| break #L5; |
| } |
| } |
| } |
| { |
| if(#0#0 is core::double && (let final dynamic #t8 = y = #0#0{core::double} in true)) { |
| #t5 = 0; |
| break #L5; |
| } |
| } |
| { |
| hoisted core::bool y1; |
| if(#0#0 is core::bool && (let final dynamic #t9 = y1 = #0#0{core::bool} in true)) { |
| { |
| #t5 = 1; |
| break #L5; |
| } |
| } |
| } |
| { |
| if(#0#0 is core::List<dynamic> && (let final dynamic #t10 = y2 = #0#0{core::List<dynamic>} in true) || true) { |
| #t5 = 1; |
| break #L5; |
| } |
| } |
| } |
| switch(#t5) /* dynamic */ { |
| #L6: |
| case #C3: |
| { |
| { |
| return "num"; |
| } |
| } |
| #L7: |
| case #C4: |
| default: |
| { |
| { |
| return "other"; |
| } |
| } |
| } |
| } |
| } |
| static method main() → dynamic { |
| self::expectEquals(self::test1(0), 0); |
| self::expectEquals(self::test1(1), 0); |
| self::expectEquals(self::test1(2), 0); |
| self::expectEquals(self::test1("foo"), 0); |
| self::expectEquals(self::test1("bar"), 0); |
| self::expectEquals(self::test1("foobar"), 0); |
| self::expectEquals(self::test1(3.14), 0); |
| self::expectEquals(self::test1(null), 1); |
| self::expectEquals(self::test1(false), 1); |
| self::expectEquals(self::test2("foo"), "String"); |
| self::expectEquals(self::test2(0), "num"); |
| self::expectEquals(self::test2(3.14), "num"); |
| self::expectEquals(self::test2(false), "other"); |
| self::expectEquals(self::test2(<core::Object>[1, "2"]), "other"); |
| self::expectEquals(self::test2(null), "other"); |
| } |
| 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 = "foo" |
| #C2 = "foobar" |
| #C3 = 0 |
| #C4 = 1 |
| } |