| library; |
| import self as self; |
| import "dart:core" as core; |
| |
| static method test1() → dynamic |
| return block { |
| final core::Map<dynamic, dynamic> #t1 = <dynamic, dynamic>{}; |
| { |
| synthesized core::Iterator<core::List<core::Object?>> :sync-for-iterator = core::_GrowableList::•<core::List<core::Object?>>(0).{core::Iterable::iterator}{core::Iterator<core::List<core::Object?>>}; |
| for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) { |
| final core::List<core::Object?> #t2 = :sync-for-iterator.{core::Iterator::current}{core::List<core::Object?>}; |
| { |
| hoisted core::Object? i; |
| { |
| final synthesized core::List<core::Object?> #0#0 = #t2; |
| if(!(#0#0.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C1 && (let final core::Object? #t3 = i = #0#0.{core::List::[]}(0){(core::int) → core::Object?} in true))) |
| throw{for-error-handling} new core::StateError::•("Pattern matching error"); |
| } |
| #t1.{core::Map::[]=}{Invariant}(i, i){(dynamic, dynamic) → void}; |
| } |
| } |
| } |
| } =>#t1; |
| static method test2(dynamic x, dynamic another) → dynamic |
| return block { |
| final core::Map<dynamic, dynamic> #t4 = <dynamic, dynamic>{}; |
| #t4.{core::Map::[]=}{Invariant}(1, 1){(dynamic, dynamic) → void}; |
| { |
| synthesized core::Iterator<dynamic> :sync-for-iterator = (x as{TypeError,ForDynamic} core::Iterable<dynamic>).{core::Iterable::iterator}{core::Iterator<dynamic>}; |
| for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) { |
| final dynamic #t5 = :sync-for-iterator.{core::Iterator::current}{dynamic}; |
| { |
| hoisted dynamic i; |
| { |
| final synthesized dynamic #0#0 = #t5; |
| if(!(#0#0 is core::List<dynamic> && #0#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C1 && (let final dynamic #t6 = i = #0#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic} in true))) |
| throw{for-error-handling} new core::StateError::•("Pattern matching error"); |
| } |
| { |
| synthesized core::Iterator<dynamic> :sync-for-iterator = (x as{TypeError,ForDynamic} core::Iterable<dynamic>).{core::Iterable::iterator}{core::Iterator<dynamic>}; |
| for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) { |
| final dynamic #t7 = :sync-for-iterator.{core::Iterator::current}{dynamic}; |
| { |
| hoisted dynamic j; |
| { |
| final synthesized dynamic #1#0 = #t7; |
| if(!(#1#0 is core::List<dynamic> && #1#0{core::List<dynamic>}.{core::List::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C1 && (let final dynamic #t8 = j = #1#0{core::List<dynamic>}.{core::List::[]}(0){(core::int) → dynamic} in true))) |
| throw{for-error-handling} new core::StateError::•("Pattern matching error"); |
| } |
| #t4.{core::Map::addAll}{Invariant}(another as{TypeError,ForDynamic} core::Map<dynamic, dynamic>){(core::Map<dynamic, dynamic>) → void}; |
| } |
| } |
| } |
| } |
| } |
| } |
| } =>#t4; |
| static method main() → dynamic { |
| self::expectEquals(self::mapToString(self::test1() as{TypeError,ForDynamic} core::Map<dynamic, dynamic>), self::mapToString(<dynamic, dynamic>{})); |
| self::expectEquals(self::mapToString(self::test2(core::_GrowableList::•<dynamic>(0), <core::int, core::int>{2: 2}) as{TypeError,ForDynamic} core::Map<dynamic, dynamic>), self::mapToString(<dynamic, dynamic>{1: 1})); |
| self::expectEquals(self::mapToString(self::test2(core::_GrowableList::_literal3<core::List<core::int>>(core::_GrowableList::_literal1<core::int>(0), core::_GrowableList::_literal1<core::int>(1), core::_GrowableList::_literal1<core::int>(2)), <core::int, core::int>{2: 2}) as{TypeError,ForDynamic} core::Map<dynamic, dynamic>), self::mapToString(<dynamic, dynamic>{1: 1, 2: 2})); |
| } |
| 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}'."; |
| } |
| } |
| static method mapToString(core::Map<dynamic, dynamic> map) → dynamic { |
| core::List<core::String> entryStrings = block { |
| final core::List<core::String> #t9 = core::_GrowableList::•<core::String>(0); |
| { |
| synthesized core::Iterator<core::MapEntry<dynamic, dynamic>> :sync-for-iterator = map.{core::Map::entries}{core::Iterable<core::MapEntry<dynamic, dynamic>>}.{core::Iterable::iterator}{core::Iterator<core::MapEntry<dynamic, dynamic>>}; |
| for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) { |
| core::MapEntry<dynamic, dynamic> e = :sync-for-iterator.{core::Iterator::current}{core::MapEntry<dynamic, dynamic>}; |
| #t9.{core::List::add}{Invariant}("${e.{core::MapEntry::key}{dynamic}}:${e.{core::MapEntry::value}{dynamic}}"){(core::String) → void}; |
| } |
| } |
| } =>#t9; |
| entryStrings.{core::List::sort}(){([(core::String, core::String) →? core::int]) → void}; |
| return "{${entryStrings.{core::Iterable::join}(","){([core::String]) → core::String}}}"; |
| } |
| |
| constants { |
| #C1 = 1 |
| } |