blob: ead872827dbed420bb1817926e7d5e68cda0c4a8 [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;
function ##0#6#initializer() → dynamic
return (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(0){(core::int) → dynamic};
late final synthesized dynamic #0#6 = ##0#6#initializer(){() → 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 core::int #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;
function ##0#6#initializer() → dynamic
return (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(0){(core::int) → dynamic};
late final synthesized dynamic #0#6 = ##0#6#initializer(){() → 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 core::int #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;
function ##0#2#initializer() → core::int
return (#0#0 as{Unchecked} core::List<dynamic>).{core::List::length}{core::int};
late final synthesized core::int #0#2 = ##0#2#initializer(){() → core::int};
function ##0#6#initializer() → dynamic
return (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(#0#2.{core::num::-}(1){(core::num) → core::int}){(core::int) → dynamic};
late final synthesized dynamic #0#6 = ##0#6#initializer(){() → dynamic};
if(#0#0 is core::List<dynamic> && #0#2.{core::num::>=}(#C1){(core::num) → core::bool} && (#0#6 is core::int && (let final core::int #t3 = y = #0#6{core::int} in true))) {
return y;
}
else {
return null;
}
}
}
static method main() dynamic {
self::expectEquals(self::test1(core::_GrowableList::_literal1<core::int>(1)), 1);
self::expectEquals(self::test1(core::_GrowableList::_literal3<core::int>(1, 2, 3)), null);
self::expectEquals(self::test1(core::_GrowableList::•<dynamic>(0)), null);
self::expectEquals(self::test1("foo"), null);
self::expectEquals(self::test2(core::_GrowableList::_literal1<core::int>(1)), 1);
self::expectEquals(self::test2(core::_GrowableList::_literal3<core::int>(1, 2, 3)), 1);
self::expectEquals(self::test2(core::_GrowableList::•<dynamic>(0)), null);
self::expectEquals(self::test2("foo"), null);
self::expectEquals(self::test3(core::_GrowableList::_literal1<core::int>(1)), 1);
self::expectEquals(self::test3(core::_GrowableList::_literal3<core::int>(1, 2, 3)), 3);
self::expectEquals(self::test3(core::_GrowableList::•<dynamic>(0)), 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
}