blob: 3033ce3325bac5decb243388405b76aefe7e4a49 [file] [log] [blame]
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
static method test(dynamic o, [dynamic expectedRest = #C1]) → dynamic {
#L1:
{
final synthesized dynamic #0#0 = o;
function ##0#2#initializer() → core::int
return #0#0{core::List<dynamic>}.{core::List::length}{core::int};
late final synthesized core::int #0#2 = ##0#2#initializer(){() → core::int};
function ##0#4#initializer() → core::bool
return #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
late final synthesized core::bool #0#4 = ##0#4#initializer(){() → core::bool};
function ##0#8#initializer() → core::bool
return #C3 =={core::num::==}{(core::Object) → core::bool} #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic};
late final synthesized core::bool #0#8 = ##0#8#initializer(){() → core::bool};
function ##0#9#initializer() → dynamic
return #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic};
late final synthesized dynamic #0#9 = ##0#9#initializer(){() → dynamic};
function ##0#12#initializer() → dynamic
return #0#0{core::List<dynamic>}.{core::List::[]}(#0#2.{core::num::-}(1){(core::num) → core::int}){(core::int) → dynamic};
late final synthesized dynamic #0#12 = ##0#12#initializer(){() → dynamic};
function ##0#19#initializer() → core::bool
return #0#2.{core::num::>=}(#C4){(core::num) → core::bool};
late final synthesized core::bool #0#19 = ##0#19#initializer(){() → core::bool};
function ##0#22#initializer() → core::List<dynamic>
return #0#0{core::List<dynamic>}.{core::List::sublist}(2, #0#2.{core::num::-}(2){(core::num) → core::int}){(core::int, [core::int?]) → core::List<dynamic>};
late final synthesized core::List<dynamic> #0#22 = ##0#22#initializer(){() → core::List<dynamic>};
function ##0#24#initializer() → core::bool
return #C2 =={core::num::==}{(core::Object) → core::bool} #0#0{core::List<dynamic>}.{core::List::[]}(#0#2.{core::num::-}(2){(core::num) → core::int}){(core::int) → dynamic};
late final synthesized core::bool #0#24 = ##0#24#initializer(){() → core::bool};
function ##0#26#initializer() → core::bool
return #C5 =={core::num::==}{(core::Object) → core::bool} #0#12;
late final synthesized core::bool #0#26 = ##0#26#initializer(){() → core::bool};
function ##0#29#initializer() → core::int
return #0#22.{core::List::length}{core::int};
late final synthesized core::int #0#29 = ##0#29#initializer(){() → core::int};
{
if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#4 && #0#8 && #C6 =={core::num::==}{(core::Object) → core::bool} #0#9) {
{
return 0;
}
}
}
{
if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#4 && #0#8 && #C6 =={core::num::==}{(core::Object) → core::bool} #0#12) {
{
return 1;
}
}
}
{
hoisted core::List<dynamic> rest;
if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#4 && #0#8 && #C2 =={core::num::==}{(core::Object) → core::bool} #0#9 && (let final core::List<dynamic> #t1 = rest = #0#0{core::List<dynamic>}.{core::List::sublist}(2){(core::int, [core::int?]) → core::List<dynamic>} in true)) {
{
self::expect(expectedRest, rest);
return 2;
}
}
}
{
hoisted core::List<dynamic> rest;
if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#4 && #0#8 && (let final core::List<dynamic> #t2 = rest = #0#0{core::List<dynamic>}.{core::List::sublist}(1, #0#2.{core::num::-}(1){(core::num) → core::int}){(core::int, [core::int?]) → core::List<dynamic>} in true) && #C2 =={core::num::==}{(core::Object) → core::bool} #0#12) {
{
self::expect(expectedRest, rest);
return 3;
}
}
}
{
hoisted core::List<dynamic> rest;
if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#19 && #0#8 && #C4 =={core::num::==}{(core::Object) → core::bool} #0#9 && (let final core::List<dynamic> #t3 = rest = #0#22 in true) && #0#24 && #0#26) {
{
self::expect(expectedRest, rest);
return 4;
}
}
}
{
hoisted core::List<dynamic> rest;
if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#19 && #0#8 && #C7 =={core::num::==}{(core::Object) → core::bool} #0#9 && (#0#29.{core::num::>=}(#C2){(core::num) → core::bool} && #C6 =={core::num::==}{(core::Object) → core::bool} #0#22.{core::List::[]}(0){(core::int) → dynamic} && (let final core::List<dynamic> #t4 = rest = #0#22.{core::List::sublist}(1, #0#29.{core::num::-}(1){(core::num) → core::int}){(core::int, [core::int?]) → core::List<dynamic>} in true) && #C2 =={core::num::==}{(core::Object) → core::bool} #0#22.{core::List::[]}(#0#29.{core::num::-}(1){(core::num) → core::int}){(core::int) → dynamic}) && #0#24 && #0#26) {
{
self::expect(expectedRest, rest);
return 5;
}
}
}
}
}
static method main() dynamic {
self::expect(0, self::test(core::_GrowableList::_literal2<core::int>(0, 1)));
self::expect(0, self::test(core::_GrowableList::_literal3<core::int>(0, 1, 2)));
self::expect(1, self::test(core::_GrowableList::_literal3<core::int>(0, 2, 1)));
self::expect(1, self::test(core::_GrowableList::_literal4<core::int>(0, 2, 3, 1)));
self::expect(2, self::test(core::_GrowableList::_literal2<core::int>(0, 2), core::_GrowableList::•<dynamic>(0)));
self::expect(2, self::test(core::_GrowableList::_literal3<core::int>(0, 2, 2), core::_GrowableList::_literal1<core::int>(2)));
self::expect(2, self::test(core::_GrowableList::_literal3<core::int>(0, 2, 3), core::_GrowableList::_literal1<core::int>(3)));
self::expect(2, self::test(core::_GrowableList::_literal4<core::int>(0, 2, 3, 4), core::_GrowableList::_literal2<core::int>(3, 4)));
self::expect(3, self::test(core::_GrowableList::_literal4<core::int>(0, 3, 4, 2), core::_GrowableList::_literal2<core::int>(3, 4)));
self::expect(3, self::test(core::_GrowableList::_literal5<core::int>(0, 3, 4, 5, 2), core::_GrowableList::_literal3<core::int>(3, 4, 5)));
self::expect(4, self::test(core::_GrowableList::_literal4<core::int>(0, 4, 2, 3), core::_GrowableList::•<dynamic>(0)));
self::expect(4, self::test(core::_GrowableList::_literal5<core::int>(0, 4, 2, 2, 3), core::_GrowableList::_literal1<core::int>(2)));
self::expect(4, self::test(core::_GrowableList::_literal6<core::int>(0, 4, 2, 3, 2, 3), core::_GrowableList::_literal2<core::int>(2, 3)));
self::expect(null, self::test(core::_GrowableList::_literal5<core::int>(0, 5, 3, 2, 3)));
self::expect(null, self::test(core::_GrowableList::_literal5<core::Object>(0, 5, core::_GrowableList::•<dynamic>(0), 2, 3)));
self::expect(null, self::test(core::_GrowableList::_literal5<core::Object>(0, 5, core::_GrowableList::_literal2<core::int>(0, 1), 2, 3)));
self::expect(5, self::test(core::_GrowableList::_literal6<core::int>(0, 5, 1, 2, 2, 3), core::_GrowableList::•<dynamic>(0)));
self::expect(5, self::test(core::_GrowableList::_literal7<core::int>(0, 5, 1, 3, 2, 2, 3), core::_GrowableList::_literal1<core::int>(3)));
}
static method expect(dynamic expected, dynamic actual) dynamic {
if(expected is{ForNonNullableByDefault} core::List<dynamic> && actual is{ForNonNullableByDefault} core::List<dynamic>) {
if(expected{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) core::bool} actual{core::List<dynamic>}.{core::List::length}{core::int}) {
for (core::int i = 0; i.{core::num::<}(expected{core::List<dynamic>}.{core::List::length}{core::int}){(core::num) core::bool}; i = i.{core::num::+}(1){(core::num) core::int}) {
if(!(expected{core::List<dynamic>}.{core::List::[]}(i){(core::int) dynamic} =={core::Object::==}{(core::Object) core::bool} actual{core::List<dynamic>}.{core::List::[]}(i){(core::int) dynamic})) {
throw "Expected ${expected{core::List<dynamic>}.{core::List::[]}(i){(core::int) → dynamic}}, actual ${actual{core::List<dynamic>}.{core::List::[]}(i){(core::int) → dynamic}} @ index ${i}";
}
}
return;
}
}
if(!(expected =={core::Object::==}{(core::Object) core::bool} actual))
throw "Expected ${expected}, actual ${actual}";
}
constants {
#C1 = null
#C2 = 2
#C3 = 0
#C4 = 4
#C5 = 3
#C6 = 1
#C7 = 5
}