blob: b9c52333fe115ebc1ecdf365082b85ec8f3cd779 [file]
library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;
import "dart:collection" as col;
import "dart:collection";
abstract class _MyMap&Object&MapMixin<K extends core::Object? = dynamic, V extends core::Object? = dynamic> extends core::Object implements col::MapMixin<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%> /*isAnonymousMixin,isEliminatedMixin,hasConstConstructor*/ {
const synthetic constructor •() self::_MyMap&Object&MapMixin<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>
: super core::Object::•()
;
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ containsKey(core::Object? key) core::bool
return this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::contains}(key){(core::Object?) core::bool};
abstract operator /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ [](core::Object? key) self::_MyMap&Object&MapMixin::V?;
abstract operator /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ []=(covariant-by-class self::_MyMap&Object&MapMixin::K% key, covariant-by-class self::_MyMap&Object&MapMixin::V% value) void;
abstract method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ clear() void;
abstract method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ remove(core::Object? key) self::_MyMap&Object&MapMixin::V?;
abstract get /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ keys() core::Iterable<self::_MyMap&Object&MapMixin::K%>;
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ cast<RK extends core::Object? = dynamic, RV extends core::Object? = dynamic>() core::Map<self::_MyMap&Object&MapMixin::cast::RK%, self::_MyMap&Object&MapMixin::cast::RV%>
return core::Map::castFrom<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%, self::_MyMap&Object&MapMixin::cast::RK%, self::_MyMap&Object&MapMixin::cast::RV%>(this);
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ forEach((self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) void action) void {
{
synthesized core::Iterator<self::_MyMap&Object&MapMixin::K%> :sync-for-iterator = this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::iterator}{core::Iterator<self::_MyMap&Object&MapMixin::K%>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
self::_MyMap&Object&MapMixin::K% key = :sync-for-iterator.{core::Iterator::current}{self::_MyMap&Object&MapMixin::K%};
{
action(key, let self::_MyMap&Object&MapMixin::V? #t1 = this.{col::MapMixin::[]}(key){(core::Object?) → self::_MyMap&Object&MapMixin::V?} in #t1 == null ?{self::_MyMap&Object&MapMixin::V%} #t1 : #t1{self::_MyMap&Object&MapMixin::V%}){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → void};
}
}
}
}
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ addAll(covariant-by-class core::Map<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%> other) void {
other.{core::Map::forEach}((self::_MyMap&Object&MapMixin::K% key, self::_MyMap&Object&MapMixin::V% value) void {
this.{col::MapMixin::[]=}(key, value){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) void};
}){((self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) void) void};
}
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ containsValue(core::Object? value) core::bool {
{
synthesized core::Iterator<self::_MyMap&Object&MapMixin::K%> :sync-for-iterator = this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::iterator}{core::Iterator<self::_MyMap&Object&MapMixin::K%>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
self::_MyMap&Object&MapMixin::K% key = :sync-for-iterator.{core::Iterator::current}{self::_MyMap&Object&MapMixin::K%};
{
if(this.{col::MapMixin::[]}(key){(core::Object?) self::_MyMap&Object&MapMixin::V?} =={core::Object::==}{(core::Object) core::bool} value)
return true;
}
}
}
return false;
}
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ putIfAbsent(covariant-by-class self::_MyMap&Object&MapMixin::K% key, covariant-by-class () self::_MyMap&Object&MapMixin::V% ifAbsent) self::_MyMap&Object&MapMixin::V% {
if(this.{col::MapMixin::containsKey}(key){(core::Object?) core::bool}) {
return let self::_MyMap&Object&MapMixin::V? #t2 = this.{col::MapMixin::[]}(key){(core::Object?) → self::_MyMap&Object&MapMixin::V?} in #t2 == null ?{self::_MyMap&Object&MapMixin::V%} #t2 : #t2{self::_MyMap&Object&MapMixin::V%};
}
return let final self::_MyMap&Object&MapMixin::K% #t3 = key in let final self::_MyMap&Object&MapMixin::V% #t4 = ifAbsent(){() → self::_MyMap&Object&MapMixin::V%} in let final void #t5 = this.{col::MapMixin::[]=}(#t3, #t4){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → void} in #t4;
}
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ update(covariant-by-class self::_MyMap&Object&MapMixin::K% key, covariant-by-class (self::_MyMap&Object&MapMixin::V%) self::_MyMap&Object&MapMixin::V% update, {covariant-by-class () →? self::_MyMap&Object&MapMixin::V% ifAbsent = #C1}) → self::_MyMap&Object&MapMixin::V% {
if(this.{col::MapMixin::containsKey}(key){(core::Object?) core::bool}) {
return let final self::_MyMap&Object&MapMixin::K% #t6 = key in let final self::_MyMap&Object&MapMixin::V% #t7 = update(let self::_MyMap&Object&MapMixin::V? #t8 = this.{col::MapMixin::[]}(key){(core::Object?) → self::_MyMap&Object&MapMixin::V?} in #t8 == null ?{self::_MyMap&Object&MapMixin::V%} #t8 : #t8{self::_MyMap&Object&MapMixin::V%}){(self::_MyMap&Object&MapMixin::V%) → self::_MyMap&Object&MapMixin::V%} in let final void #t9 = this.{col::MapMixin::[]=}(#t6, #t7){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → void} in #t7;
}
if(!(ifAbsent == null)) {
return let final self::_MyMap&Object&MapMixin::K% #t10 = key in let final self::_MyMap&Object&MapMixin::V% #t11 = ifAbsent{() → self::_MyMap&Object&MapMixin::V%}(){() → self::_MyMap&Object&MapMixin::V%} in let final void #t12 = this.{col::MapMixin::[]=}(#t10, #t11){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → void} in #t11;
}
throw new core::ArgumentError::value(key, "key", "Key not in map.");
}
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ updateAll(covariant-by-class (self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) self::_MyMap&Object&MapMixin::V% update) void {
{
synthesized core::Iterator<self::_MyMap&Object&MapMixin::K%> :sync-for-iterator = this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::iterator}{core::Iterator<self::_MyMap&Object&MapMixin::K%>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
self::_MyMap&Object&MapMixin::K% key = :sync-for-iterator.{core::Iterator::current}{self::_MyMap&Object&MapMixin::K%};
{
this.{col::MapMixin::[]=}(key, update(key, let self::_MyMap&Object&MapMixin::V? #t13 = this.{col::MapMixin::[]}(key){(core::Object?) → self::_MyMap&Object&MapMixin::V?} in #t13 == null ?{self::_MyMap&Object&MapMixin::V%} #t13 : #t13{self::_MyMap&Object&MapMixin::V%}){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → self::_MyMap&Object&MapMixin::V%}){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → void};
}
}
}
}
get /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ entries() core::Iterable<core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>> {
return this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::map}<core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>>((self::_MyMap&Object&MapMixin::K% key) core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%> => new core::MapEntry::_<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>(key, let self::_MyMap&Object&MapMixin::V? #t14 = this.{col::MapMixin::[]}(key){(core::Object?) → self::_MyMap&Object&MapMixin::V?} in #t14 == null ?{self::_MyMap&Object&MapMixin::V%} #t14 : #t14{self::_MyMap&Object&MapMixin::V%})){((self::_MyMap&Object&MapMixin::K%) → core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>) → core::Iterable<core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>>};
}
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ map<K2 extends core::Object? = dynamic, V2 extends core::Object? = dynamic>((self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) core::MapEntry<self::_MyMap&Object&MapMixin::map::K2%, self::_MyMap&Object&MapMixin::map::V2%> transform) core::Map<self::_MyMap&Object&MapMixin::map::K2%, self::_MyMap&Object&MapMixin::map::V2%> {
core::Map<self::_MyMap&Object&MapMixin::map::K2%, self::_MyMap&Object&MapMixin::map::V2%> result = <self::_MyMap&Object&MapMixin::map::K2%, self::_MyMap&Object&MapMixin::map::V2%>{};
{
synthesized core::Iterator<self::_MyMap&Object&MapMixin::K%> :sync-for-iterator = this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::iterator}{core::Iterator<self::_MyMap&Object&MapMixin::K%>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
self::_MyMap&Object&MapMixin::K% key = :sync-for-iterator.{core::Iterator::current}{self::_MyMap&Object&MapMixin::K%};
{
core::MapEntry<self::_MyMap&Object&MapMixin::map::K2%, self::_MyMap&Object&MapMixin::map::V2%> entry = transform(key, let self::_MyMap&Object&MapMixin::V? #t15 = this.{col::MapMixin::[]}(key){(core::Object?) → self::_MyMap&Object&MapMixin::V?} in #t15 == null ?{self::_MyMap&Object&MapMixin::V%} #t15 : #t15{self::_MyMap&Object&MapMixin::V%}){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → core::MapEntry<self::_MyMap&Object&MapMixin::map::K2%, self::_MyMap&Object&MapMixin::map::V2%>};
result.{core::Map::[]=}(entry.{core::MapEntry::key}{self::_MyMap&Object&MapMixin::map::K2%}, entry.{core::MapEntry::value}{self::_MyMap&Object&MapMixin::map::V2%}){(self::_MyMap&Object&MapMixin::map::K2%, self::_MyMap&Object&MapMixin::map::V2%) void};
}
}
}
return result;
}
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ addEntries(covariant-by-class core::Iterable<core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>> newEntries) void {
{
synthesized core::Iterator<core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>> :sync-for-iterator = newEntries.{core::Iterable::iterator}{core::Iterator<core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%> entry = :sync-for-iterator.{core::Iterator::current}{core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>};
{
this.{col::MapMixin::[]=}(entry.{core::MapEntry::key}{self::_MyMap&Object&MapMixin::K%}, entry.{core::MapEntry::value}{self::_MyMap&Object&MapMixin::V%}){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) void};
}
}
}
}
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ removeWhere((self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) core::bool test) void {
core::List<self::_MyMap&Object&MapMixin::K%> keysToRemove = core::_GrowableList::•<self::_MyMap&Object&MapMixin::K%>(0);
{
synthesized core::Iterator<self::_MyMap&Object&MapMixin::K%> :sync-for-iterator = this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::iterator}{core::Iterator<self::_MyMap&Object&MapMixin::K%>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
self::_MyMap&Object&MapMixin::K% key = :sync-for-iterator.{core::Iterator::current}{self::_MyMap&Object&MapMixin::K%};
{
if(test(key, let self::_MyMap&Object&MapMixin::V? #t16 = this.{col::MapMixin::[]}(key){(core::Object?) → self::_MyMap&Object&MapMixin::V?} in #t16 == null ?{self::_MyMap&Object&MapMixin::V%} #t16 : #t16{self::_MyMap&Object&MapMixin::V%}){(self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → core::bool})
keysToRemove.{core::List::add}(key){(self::_MyMap&Object&MapMixin::K%) void};
}
}
}
{
synthesized core::Iterator<self::_MyMap&Object&MapMixin::K%> :sync-for-iterator = keysToRemove.{core::Iterable::iterator}{core::Iterator<self::_MyMap&Object&MapMixin::K%>};
for (; :sync-for-iterator.{core::Iterator::moveNext}(){() core::bool}; ) {
self::_MyMap&Object&MapMixin::K% key = :sync-for-iterator.{core::Iterator::current}{self::_MyMap&Object&MapMixin::K%};
{
this.{col::MapMixin::remove}(key){(core::Object?) self::_MyMap&Object&MapMixin::V?};
}
}
}
}
get /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ length() core::int
return this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::length}{core::int};
get /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ isEmpty() core::bool
return this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::isEmpty}{core::bool};
get /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ isNotEmpty() core::bool
return this.{col::MapMixin::keys}{core::Iterable<self::_MyMap&Object&MapMixin::K%>}.{core::Iterable::isNotEmpty}{core::bool};
get /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ values() core::Iterable<self::_MyMap&Object&MapMixin::V%>
return new col::_MapBaseValueIterable::•<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>(this);
method /* from org-dartlang-sdk:///sdk/lib/collection/maps.dart */ toString() core::String
return col::MapBase::mapToString(this);
}
class MyMap<K extends core::Object? = dynamic, V extends core::Object? = dynamic> extends self::_MyMap&Object&MapMixin<self::MyMap::K%, self::MyMap::V%> {
field core::int containsKeyCount = 0;
field core::int indexGetCount = 0;
final field core::Map<self::MyMap::K%, self::MyMap::V%> _map;
constructor •(core::Map<self::MyMap::K%, self::MyMap::V%> _map) self::MyMap<self::MyMap::K%, self::MyMap::V%>
: self::MyMap::_map = _map, super self::_MyMap&Object&MapMixin::•()
;
method containsKey(core::Object? key) core::bool {
this.{self::MyMap::containsKeyCount} = this.{self::MyMap::containsKeyCount}{core::int}.{core::num::+}(1){(core::num) core::int};
return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::containsKey}(key){(core::Object?) core::bool};
}
operator [](core::Object? key) self::MyMap::V? {
this.{self::MyMap::indexGetCount} = this.{self::MyMap::indexGetCount}{core::int}.{core::num::+}(1){(core::num) core::int};
return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::[]}(key){(core::Object?) self::MyMap::V?};
}
operator []=(covariant-by-class self::MyMap::K% key, covariant-by-class self::MyMap::V% value) void
return let final core::Map<self::MyMap::K%, self::MyMap::V%> #t17 = this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>} in let final self::MyMap::K% #t18 = key in let final self::MyMap::V% #t19 = value in let final void #t20 = #t17.{core::Map::[]=}(#t18, #t19){(self::MyMap::K%, self::MyMap::V%) → void} in #t19;
method clear() void
return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::clear}(){() void};
get keys() core::Iterable<self::MyMap::K%>
return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::keys}{core::Iterable<self::MyMap::K%>};
method remove(core::Object? key) self::MyMap::V?
return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::remove}(key){(core::Object?) self::MyMap::V?};
}
static method method(core::Map<core::int, core::String> m) core::int {
#L1:
{
final synthesized core::Map<core::int, core::String> #0#0 = m;
function ##0#3#initializer() → core::bool
return #0#0.{core::Map::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C2;
late final synthesized core::bool #0#3 = ##0#3#initializer(){() → core::bool};
function ##0#4#initializer() → core::bool
return #0#0.{core::Map::containsKey}(#C2){(core::Object?) → core::bool};
late final synthesized core::bool #0#4 = ##0#4#initializer(){() → core::bool};
function ##0#5#initializer() → core::String?
return #0#0.{core::Map::[]}(#C2){(core::Object?) → core::String?};
late final synthesized core::String? #0#5 = ##0#5#initializer(){() → core::String?};
{
if(#0#3 && #0#4 && #C3 =={core::String::==}{(core::Object) → core::bool} #0#5) {
{
return 0;
}
}
}
{
if(#0#3 && #0#4 && #C4 =={core::String::==}{(core::Object) → core::bool} #0#5) {
{
return 1;
}
}
}
}
return 2;
}
static method test(core::Map<core::int, core::String> map, {required core::int expectedValue = #C1, required core::int expectedContainsKeyCount = #C1, required core::int expectedIndexGetCount = #C1}) → dynamic {
self::MyMap<core::int, core::String> myMap = new self::MyMap::•<core::int, core::String>(map);
self::expect(expectedValue, self::method(myMap), "Unexpected value for ${map}.");
self::expect(expectedContainsKeyCount, myMap.{self::MyMap::containsKeyCount}{core::int}, "Unexpected containsKey count for ${map}.");
self::expect(expectedIndexGetCount, myMap.{self::MyMap::indexGetCount}{core::int}, "Unexpected indexGet count for ${map}.");
}
static method main() dynamic {
self::test(<core::int, core::String>{0: "foo"}, expectedValue: 2, expectedContainsKeyCount: 1, expectedIndexGetCount: 0);
self::test(<core::int, core::String>{1: "foo"}, expectedValue: 0, expectedContainsKeyCount: 1, expectedIndexGetCount: 1);
self::test(<core::int, core::String>{1: "bar"}, expectedValue: 1, expectedContainsKeyCount: 1, expectedIndexGetCount: 1);
self::test(<core::int, core::String>{1: "baz"}, expectedValue: 2, expectedContainsKeyCount: 1, expectedIndexGetCount: 1);
}
static method expect(dynamic expected, dynamic actual, dynamic message) dynamic {
if(!(expected =={core::Object::==}{(core::Object) core::bool} actual))
throw "${message} Expected ${expected}, actual ${actual}";
}
constants {
#C1 = null
#C2 = 1
#C3 = "foo"
#C4 = "bar"
}