blob: 03befb46a4c8461717923bfa0bba02e842675bca [file] [log] [blame]
library;
import self as self;
import "dart:core" as core;
static method test1(dynamic x) dynamic {
{
hoisted core::int y;
final synthesized dynamic #0#0 = x;
late final synthesized dynamic #0#6 = (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(0){(core::int) → dynamic};
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 is core::int && (let final dynamic #t1 = y = #0#6{core::int} in true))) {
return y;
}
else {
return null;
}
}
}
static method test2(dynamic x) dynamic {
{
hoisted core::int y;
final synthesized dynamic #0#0 = x;
late final synthesized dynamic #0#6 = (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(0){(core::int) → dynamic};
if(#0#0 is core::List<dynamic> && #0#0{core::List<dynamic>}.{core::List::length}{core::int}.{core::num::>=}(#C1){(core::num) → core::bool} && (#0#6 is core::int && (let final dynamic #t2 = y = #0#6{core::int} in true))) {
return y;
}
else {
return null;
}
}
}
static method test3(dynamic x) dynamic {
{
hoisted core::int y;
final synthesized dynamic #0#0 = x;
late final synthesized core::int #0#2 = (#0#0 as{Unchecked} core::List<dynamic>).{core::List::length}{core::int};
late final synthesized dynamic #0#6 = (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(#0#2.{core::num::-}(1){(core::num) → core::int}){(core::int) → dynamic};
if(#0#0 is core::List<dynamic> && #0#2.{core::num::>=}(#C1){(core::num) → core::bool} && (#0#6 is core::int && (let final dynamic #t3 = y = #0#6{core::int} in true))) {
return y;
}
else {
return null;
}
}
}
static method main() dynamic {
self::expectEquals(self::test1(<core::int>[1]), 1);
self::expectEquals(self::test1(<core::int>[1, 2, 3]), null);
self::expectEquals(self::test1(<dynamic>[]), null);
self::expectEquals(self::test1("foo"), null);
self::expectEquals(self::test2(<core::int>[1]), 1);
self::expectEquals(self::test2(<core::int>[1, 2, 3]), 1);
self::expectEquals(self::test2(<dynamic>[]), null);
self::expectEquals(self::test2("foo"), null);
self::expectEquals(self::test3(<core::int>[1]), 1);
self::expectEquals(self::test3(<core::int>[1, 2, 3]), 3);
self::expectEquals(self::test3(<dynamic>[]), null);
self::expectEquals(self::test3("foo"), 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
}