blob: f4aa326e65ab23d729bfaf77e1ff8b0f1a4f0ca2 [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
static method test1(dynamic x) dynamic {
#L1:
{
final synthesized dynamic #0#0 = x;
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{dynamic} : let final core::bool* #t1 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::int && (let final core::int #t2 = a = (#0#6#isSet ?{dynamic} #0#6{dynamic} : let final core::bool* #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 {
#L2:
{
final synthesized dynamic #0#0 = x;
synthesized core::bool #0#4;
synthesized core::bool #0#4#isSet = false;
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{core::bool} : let final core::bool* #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{dynamic} : let final core::bool* #t6 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) is core::num && (let final core::num #t7 = a#case#0 = (#0#6#isSet ?{dynamic} #0#6{dynamic} : let final core::bool* #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 core::num #t9 = #t4 = a#case#0 in true) || #0#0 is core::List<dynamic> && (#0#4#isSet ?{core::bool} #0#4{core::bool} : let final core::bool* #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{dynamic} : let final core::bool* #t11 = #0#7#isSet = true in #0#7 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}) is core::num && (let final core::num #t12 = a#case#1 = (#0#7#isSet ?{dynamic} #0#7{dynamic} : let final core::bool* #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 core::num #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::_GrowableList::_literal1<core::int>(1)));
self::expectEquals(null, self::test1(core::_GrowableList::_literal1<core::int>(0)));
self::expectEquals(null, self::test1(core::_GrowableList::_literal1<core::int>(1.{core::int::unary-}(){() core::int})));
self::expectEquals(null, self::test2(core::_GrowableList::_literal2<core::Object>(1, "two")));
self::expectEquals(2, self::test2(core::_GrowableList::_literal2<core::Object>(2, "three")));
self::expectEquals(null, self::test2(core::_GrowableList::_literal2<core::Object>("one", 1.5)));
self::expectEquals(2.5, self::test2(core::_GrowableList::_literal2<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
}
Extra constant evaluation status:
Evaluated: InstanceInvocation @ org-dartlang-testcase:///simple_switch_with_guards_runtime.dart:27:29 -> IntConstant(-1)
Extra constant evaluation: evaluated: 158, effectively constant: 1