blob: 3435b61679c3a09efe97ae6858ae204b15469d1f [file] [log] [blame]
library;
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;
late final synthesized core::int #0#2 = (#0#0 as{Unchecked} core::List<dynamic>).{core::List::length}{core::int};
late final synthesized core::bool #0#4 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool};
late final synthesized core::bool #0#8 = #C3 =={core::num::==}{(core::Object) → core::bool} #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic};
late final synthesized dynamic #0#9 = (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(1){(core::int) → dynamic};
late final synthesized dynamic #0#12 = (#0#0 as{Unchecked} core::List<dynamic>).{core::List::[]}(#0#2.{core::num::-}(1){(core::num) → core::int}){(core::int) → dynamic};
late final synthesized core::bool #0#19 = #0#2.{core::num::>=}(#C4){(core::num) → core::bool};
late final synthesized core::List<dynamic> #0#22 = (#0#0 as{Unchecked} 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::bool #0#24 = #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#26 = #C5 =={core::num::==}{(core::Object) → core::bool} #0#12;
late final synthesized core::int #0#29 = #0#22.{core::List::length}{core::int};
{
if(#0#0 is core::List<dynamic> && #0#4 && #0#8 && #C6 =={core::num::==}{(core::Object) → core::bool} #0#9) {
{
return 0;
}
}
}
{
if(#0#0 is 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 core::List<dynamic> && #0#4 && #0#8 && #C2 =={core::num::==}{(core::Object) → core::bool} #0#9 && (let final 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 core::List<dynamic> && #0#4 && #0#8 && (let final 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 core::List<dynamic> && #0#19 && #0#8 && #C4 =={core::num::==}{(core::Object) → core::bool} #0#9 && (let final 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 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 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::int>[0, 1]));
self::expect(0, self::test(<core::int>[0, 1, 2]));
self::expect(1, self::test(<core::int>[0, 2, 1]));
self::expect(1, self::test(<core::int>[0, 2, 3, 1]));
self::expect(2, self::test(<core::int>[0, 2], <dynamic>[]));
self::expect(2, self::test(<core::int>[0, 2, 2], <core::int>[2]));
self::expect(2, self::test(<core::int>[0, 2, 3], <core::int>[3]));
self::expect(2, self::test(<core::int>[0, 2, 3, 4], <core::int>[3, 4]));
self::expect(3, self::test(<core::int>[0, 3, 4, 2], <core::int>[3, 4]));
self::expect(3, self::test(<core::int>[0, 3, 4, 5, 2], <core::int>[3, 4, 5]));
self::expect(4, self::test(<core::int>[0, 4, 2, 3], <dynamic>[]));
self::expect(4, self::test(<core::int>[0, 4, 2, 2, 3], <core::int>[2]));
self::expect(4, self::test(<core::int>[0, 4, 2, 3, 2, 3], <core::int>[2, 3]));
self::expect(null, self::test(<core::int>[0, 5, 3, 2, 3]));
self::expect(null, self::test(<core::Object>[0, 5, <dynamic>[], 2, 3]));
self::expect(null, self::test(<core::Object>[0, 5, <core::int>[0, 1], 2, 3]));
self::expect(5, self::test(<core::int>[0, 5, 1, 2, 2, 3], <dynamic>[]));
self::expect(5, self::test(<core::int>[0, 5, 1, 3, 2, 2, 3], <core::int>[3]));
}
static method expect(dynamic expected, dynamic actual) dynamic {
if(expected is core::List<dynamic> && actual is 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
}