| library /*isNonNullableByDefault*/; |
| import self as self; |
| import "dart:core" as core; |
| |
| static method test(dynamic o, [dynamic expectedRest = #C1]) → dynamic { |
| #L1: |
| { |
| core::List<dynamic> rest; |
| core::List<dynamic> rest#1; |
| core::List<dynamic> rest#2; |
| core::List<dynamic> rest#3; |
| final dynamic #0#0 = o; |
| late final core::int #0#2 = #0#0{core::List<dynamic>}.{core::List::length}{core::int}; |
| late final core::bool #0#4 = #0#2.{core::num::>=}(#C2){(core::num) → core::bool}; |
| late final dynamic #0#6 = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic}; |
| late final dynamic #0#9 = #0#0{core::List<dynamic>}.{core::List::[]}(1){(core::int) → dynamic}; |
| late final dynamic #0#14 = #0#0{core::List<dynamic>}.{core::List::[]}(#0#2.{core::num::-}(1){(core::num) → core::int}){(core::int) → dynamic}; |
| late final core::bool #0#28 = #0#2.{core::num::>=}(#C3){(core::num) → core::bool}; |
| late final core::List<dynamic> #0#34 = #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 dynamic #0#35 = #0#0{core::List<dynamic>}.{core::List::[]}(#0#2.{core::num::-}(2){(core::num) → core::int}){(core::int) → dynamic}; |
| late final core::int #0#44 = #0#34.{core::List::length}{core::int}; |
| if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#4 && #C4 =={core::num::==}{(core::Object) → core::bool} #0#6 && #C5 =={core::num::==}{(core::Object) → core::bool} #0#9) { |
| { |
| return 0; |
| } |
| } |
| else |
| if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#4 && #C4 =={core::num::==}{(core::Object) → core::bool} #0#6 && #C5 =={core::num::==}{(core::Object) → core::bool} #0#14) { |
| { |
| return 1; |
| } |
| } |
| else |
| if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#4 && #C4 =={core::num::==}{(core::Object) → core::bool} #0#6 && #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; |
| } |
| } |
| else |
| if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#4 && #C4 =={core::num::==}{(core::Object) → core::bool} #0#6 && (let final dynamic #t2 = rest#1 = #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#14) { |
| { |
| self::expect(expectedRest, rest#1); |
| return 3; |
| } |
| } |
| else |
| if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#28 && #C4 =={core::num::==}{(core::Object) → core::bool} #0#6 && #C3 =={core::num::==}{(core::Object) → core::bool} #0#9 && (let final dynamic #t3 = rest#2 = #0#34 in true) && #C2 =={core::num::==}{(core::Object) → core::bool} #0#35 && #C6 =={core::num::==}{(core::Object) → core::bool} #0#14) { |
| { |
| self::expect(expectedRest, rest#2); |
| return 4; |
| } |
| } |
| else |
| if(#0#0 is{ForNonNullableByDefault} core::List<dynamic> && #0#28 && #C4 =={core::num::==}{(core::Object) → core::bool} #0#6 && #C7 =={core::num::==}{(core::Object) → core::bool} #0#9 && (#0#44.{core::num::>=}(#C2){(core::num) → core::bool} && #C5 =={core::num::==}{(core::Object) → core::bool} #0#34.{core::List::[]}(0){(core::int) → dynamic} && (let final dynamic #t4 = rest#3 = #0#34.{core::List::sublist}(1, #0#44.{core::num::-}(1){(core::num) → core::int}){(core::int, [core::int?]) → core::List<dynamic>} in true) && #C2 =={core::num::==}{(core::Object) → core::bool} #0#34.{core::List::[]}(#0#44.{core::num::-}(1){(core::num) → core::int}){(core::int) → dynamic}) && #C2 =={core::num::==}{(core::Object) → core::bool} #0#35 && #C6 =={core::num::==}{(core::Object) → core::bool} #0#14) { |
| { |
| self::expect(expectedRest, rest#3); |
| 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{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 = 4 |
| #C4 = 0 |
| #C5 = 1 |
| #C6 = 3 |
| #C7 = 5 |
| } |