blob: df89b6b41949691d581b759ab0a6539118a256bb [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;
{
hoisted core::int x;
if(#0#0 is core::int && (let final core::int #t1 = x = #0#0{core::int} in true)) {
{
{
core::String x = "foo";
return x;
}
}
}
}
{
{
{
return "bar";
}
}
}
}
}
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;
{
lowered hoisted core::int x#case#0;
lowered hoisted core::int x#case#1;
if(#0#0 is core::List<dynamic> && (#0#4#isSet ?{core::bool} #0#4{core::bool} : let final core::bool #t2 = #0#4#isSet = true in #0#4 = #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 #t3 = #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 #t4 = x#case#0 = (#0#6#isSet ?{dynamic} #0#6{dynamic} : let final core::bool #t5 = #0#6#isSet = true in #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}) as{Unchecked} core::int in true)) || #0#0 is core::List<dynamic> && (#0#4#isSet ?{core::bool} #0#4{core::bool} : let final core::bool #t6 = #0#4#isSet = true in #0#4 = #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C1) && ((#0#7#isSet ?{dynamic} #0#7{dynamic} : let final core::bool #t7 = #0#7#isSet = true in #0#7 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}) is core::int && (let final core::int #t8 = x#case#1 = (#0#7#isSet ?{dynamic} #0#7{dynamic} : let final core::bool #t9 = #0#7#isSet = true in #0#7 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}) as{Unchecked} core::int in true))) {
{
core::String x = "foo";
return x;
}
}
}
{
{
{
return "bar";
}
}
}
}
}
static method test3(dynamic x) dynamic {
{
final synthesized dynamic #0#0 = x;
{
hoisted core::int x;
if(#0#0 is core::int) {
x = #0#0{core::int};
{
core::String x = "foo";
return x;
}
}
else {
return "bar";
}
}
}
}
static method test4(dynamic x) dynamic {
core::Function f = () core::int => 0;
{
final synthesized dynamic #0#0 = x;
{
hoisted core::int x;
if(#0#0 is core::int) {
x = #0#0{core::int};
{
core::String x = (() core::String {
f = () core::int => 1;
return "foo";
})(){() core::String};
}
}
}
}
return f();
}
static method main() dynamic {
self::expectEquals(self::test1(0), "foo");
self::expectEquals(self::test1("foo"), "bar");
self::expectEquals(self::test2(core::_GrowableList::_literal2<core::Object>(0, false)), "foo");
self::expectEquals(self::test2(core::_GrowableList::_literal2<core::Object>(false, 0)), "foo");
self::expectEquals(self::test2("foo"), "bar");
self::expectEquals(self::test3(0), "foo");
self::expectEquals(self::test3("foo"), "bar");
self::expectEquals(self::test4(0), 1);
self::expectEquals(self::test4("foo"), 0);
}
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 = 2
}