| library; | |
| import self as self; | |
| import "dart:core" as core; | |
| static method test1(dynamic x) → dynamic { | |
| { | |
| final synthesized dynamic #0#0 = x; | |
| final const synthesized core::int #0#3 = #C1; | |
| synthesized dynamic #0#6; | |
| synthesized core::bool #0#6#isSet = false; | |
| { | |
| hoisted core::int a; | |
| if(#0#0 is core::List<dynamic> && #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C1 && ((#0#6#isSet ?{dynamic} #0#6 : let final dynamic #t1 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::int && (let final dynamic #t2 = a = (#0#6#isSet ?{dynamic} #0#6 : let final dynamic #t3 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::int in true)) && a.{core::num::>}(0){(core::num) → core::bool}) { | |
| { | |
| return a; | |
| } | |
| } | |
| } | |
| { | |
| { | |
| { | |
| return null; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| static method test2(dynamic x) → dynamic { | |
| { | |
| final synthesized dynamic #0#0 = x; | |
| synthesized core::bool #0#4; | |
| synthesized core::bool #0#4#isSet = false; | |
| final const synthesized core::int #0#3 = #C2; | |
| synthesized dynamic #0#6; | |
| synthesized core::bool #0#6#isSet = false; | |
| synthesized dynamic #0#7; | |
| synthesized core::bool #0#7#isSet = false; | |
| dynamic #t4; | |
| { | |
| lowered hoisted core::num a#case#0; | |
| lowered hoisted core::num a#case#1; | |
| if(#0#0 is core::List<dynamic> && (#0#4#isSet ?{core::bool} #0#4 : let final dynamic #t5 = #0#4#isSet = true in #0#4 = #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C2) && ((#0#6#isSet ?{dynamic} #0#6 : let final dynamic #t6 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::num && (let final dynamic #t7 = a#case#0 = (#0#6#isSet ?{dynamic} #0#6 : let final dynamic #t8 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::num in true)) && (a#case#0 is core::int && a#case#0{core::int}.{core::int::isEven}{core::bool}) && (let final dynamic #t9 = #t4 = a#case#0 in true) || #0#0 is core::List<dynamic> && (#0#4#isSet ?{core::bool} #0#4 : let final dynamic #t10 = #0#4#isSet = true in #0#4 = #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C2) && ((#0#7#isSet ?{dynamic} #0#7 : let final dynamic #t11 = #0#7#isSet = true in #0#7 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}) is core::num && (let final dynamic #t12 = a#case#1 = (#0#7#isSet ?{dynamic} #0#7 : let final dynamic #t13 = #0#7#isSet = true in #0#7 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}) as{Unchecked} core::num in true)) && (a#case#1 is core::double && a#case#1{core::double}.{core::double::ceil}(){() → core::int}.{core::int::isOdd}{core::bool}) && (let final dynamic #t14 = #t4 = a#case#1 in true)) { | |
| core::num a = #t4{core::num}; | |
| { | |
| return a; | |
| } | |
| } | |
| } | |
| { | |
| { | |
| { | |
| return null; | |
| } | |
| } | |
| } | |
| } | |
| } | |
| static method main() → dynamic { | |
| self::expectEquals(1, self::test1(<core::int>[1])); | |
| self::expectEquals(null, self::test1(<core::int>[0])); | |
| self::expectEquals(null, self::test1(<core::int>[1.{core::int::unary-}(){() → core::int}])); | |
| self::expectEquals(null, self::test2(<core::Object>[1, "two"])); | |
| self::expectEquals(2, self::test2(<core::Object>[2, "three"])); | |
| self::expectEquals(null, self::test2(<core::Object>["one", 1.5])); | |
| self::expectEquals(2.5, self::test2(<core::Object>["two", 2.5])); | |
| self::expectEquals(null, self::test2(null)); | |
| } | |
| 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 = 1 | |
| #C2 = 2 | |
| } |