|
| 1 | +library /*isNonNullableByDefault*/; |
| 2 | +import self as self; |
| 3 | +import "dart:core" as core; |
| 4 | +import "dart:collection" as col; |
| 5 | + |
| 6 | +import "dart:collection"; |
| 7 | + |
| 8 | +abstract class _MyMap&Object&MapMixin<K extends core::Object? = dynamic, V extends core::Object? = dynamic> = core::Object with col::MapMixin<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%> /*isAnonymousMixin,hasConstConstructor*/ { |
| 9 | + const synthetic constructor •() → self::_MyMap&Object&MapMixin<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%> |
| 10 | + : super core::Object::•() |
| 11 | + ; |
| 12 | + mixin-super-stub method containsKey(core::Object? key) → core::bool |
| 13 | + return super.{col::MapMixin::containsKey}(key); |
| 14 | + abstract mixin-stub operator [](core::Object? key) → self::_MyMap&Object&MapMixin::V?; -> col::MapMixin::[] |
| 15 | + abstract mixin-stub operator []=(covariant-by-class self::_MyMap&Object&MapMixin::K% key, covariant-by-class self::_MyMap&Object&MapMixin::V% value) → void; -> col::MapMixin::[]= |
| 16 | + abstract mixin-stub method clear() → void; -> col::MapMixin::clear |
| 17 | + abstract mixin-stub method remove(core::Object? key) → self::_MyMap&Object&MapMixin::V?; -> col::MapMixin::remove |
| 18 | + abstract mixin-stub get keys() → core::Iterable<self::_MyMap&Object&MapMixin::K%>; -> col::MapMixin::keys |
| 19 | + mixin-super-stub method 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%> |
| 20 | + return super.{col::MapMixin::cast}<self::_MyMap&Object&MapMixin::cast::RK%, self::_MyMap&Object&MapMixin::cast::RV%>(); |
| 21 | + mixin-super-stub method forEach((self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → void action) → void |
| 22 | + return super.{col::MapMixin::forEach}(action); |
| 23 | + mixin-super-stub method addAll(covariant-by-class core::Map<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%> other) → void |
| 24 | + return super.{col::MapMixin::addAll}(other); |
| 25 | + mixin-super-stub method containsValue(core::Object? value) → core::bool |
| 26 | + return super.{col::MapMixin::containsValue}(value); |
| 27 | + mixin-super-stub method putIfAbsent(covariant-by-class self::_MyMap&Object&MapMixin::K% key, covariant-by-class () → self::_MyMap&Object&MapMixin::V% ifAbsent) → self::_MyMap&Object&MapMixin::V% |
| 28 | + return super.{col::MapMixin::putIfAbsent}(key, ifAbsent); |
| 29 | + mixin-super-stub method 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% |
| 30 | + return super.{col::MapMixin::update}(key, update, ifAbsent: ifAbsent); |
| 31 | + mixin-super-stub method updateAll(covariant-by-class (self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → self::_MyMap&Object&MapMixin::V% update) → void |
| 32 | + return super.{col::MapMixin::updateAll}(update); |
| 33 | + mixin-super-stub get entries() → core::Iterable<core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>> |
| 34 | + return super.{col::MapMixin::entries}; |
| 35 | + mixin-super-stub method 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%> |
| 36 | + return super.{col::MapMixin::map}<self::_MyMap&Object&MapMixin::map::K2%, self::_MyMap&Object&MapMixin::map::V2%>(transform); |
| 37 | + mixin-super-stub method addEntries(covariant-by-class core::Iterable<core::MapEntry<self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%>> newEntries) → void |
| 38 | + return super.{col::MapMixin::addEntries}(newEntries); |
| 39 | + mixin-super-stub method removeWhere((self::_MyMap&Object&MapMixin::K%, self::_MyMap&Object&MapMixin::V%) → core::bool test) → void |
| 40 | + return super.{col::MapMixin::removeWhere}(test); |
| 41 | + mixin-super-stub get length() → core::int |
| 42 | + return super.{col::MapMixin::length}; |
| 43 | + mixin-super-stub get isEmpty() → core::bool |
| 44 | + return super.{col::MapMixin::isEmpty}; |
| 45 | + mixin-super-stub get isNotEmpty() → core::bool |
| 46 | + return super.{col::MapMixin::isNotEmpty}; |
| 47 | + mixin-super-stub get values() → core::Iterable<self::_MyMap&Object&MapMixin::V%> |
| 48 | + return super.{col::MapMixin::values}; |
| 49 | + mixin-super-stub method toString() → core::String |
| 50 | + return super.{col::MapMixin::toString}(); |
| 51 | +} |
| 52 | +class MyMap<K extends core::Object? = dynamic, V extends core::Object? = dynamic> extends self::_MyMap&Object&MapMixin<self::MyMap::K%, self::MyMap::V%> { |
| 53 | + field core::int containsKeyCount = 0; |
| 54 | + field core::int indexGetCount = 0; |
| 55 | + final field core::Map<self::MyMap::K%, self::MyMap::V%> _map; |
| 56 | + constructor •(core::Map<self::MyMap::K%, self::MyMap::V%> _map) → self::MyMap<self::MyMap::K%, self::MyMap::V%> |
| 57 | + : self::MyMap::_map = _map, super self::_MyMap&Object&MapMixin::•() |
| 58 | + ; |
| 59 | + method containsKey(core::Object? key) → core::bool { |
| 60 | + this.{self::MyMap::containsKeyCount} = this.{self::MyMap::containsKeyCount}{core::int}.{core::num::+}(1){(core::num) → core::int}; |
| 61 | + return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::containsKey}(key){(core::Object?) → core::bool}; |
| 62 | + } |
| 63 | + operator [](core::Object? key) → self::MyMap::V? { |
| 64 | + this.{self::MyMap::indexGetCount} = this.{self::MyMap::indexGetCount}{core::int}.{core::num::+}(1){(core::num) → core::int}; |
| 65 | + return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::[]}(key){(core::Object?) → self::MyMap::V?}; |
| 66 | + } |
| 67 | + operator []=(covariant-by-class self::MyMap::K% key, covariant-by-class self::MyMap::V% value) → void |
| 68 | + return let final core::Map<self::MyMap::K%, self::MyMap::V%> #t1 = this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>} in let final self::MyMap::K% #t2 = key in let final self::MyMap::V% #t3 = value in let final void #t4 = #t1.{core::Map::[]=}(#t2, #t3){(self::MyMap::K%, self::MyMap::V%) → void} in #t3; |
| 69 | + method clear() → void |
| 70 | + return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::clear}(){() → void}; |
| 71 | + get keys() → core::Iterable<self::MyMap::K%> |
| 72 | + return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::keys}{core::Iterable<self::MyMap::K%>}; |
| 73 | + method remove(core::Object? key) → self::MyMap::V? |
| 74 | + return this.{self::MyMap::_map}{core::Map<self::MyMap::K%, self::MyMap::V%>}.{core::Map::remove}(key){(core::Object?) → self::MyMap::V?}; |
| 75 | +} |
| 76 | +static method method(core::Map<core::int, core::String> m) → core::int { |
| 77 | + #L1: |
| 78 | + { |
| 79 | + final synthesized core::Map<core::int, core::String> #0#0 = m; |
| 80 | + late final synthesized core::bool #0#3 = #0#0.{core::Map::length}{core::int} =={core::num::==}{(core::Object) → core::bool} #C2; |
| 81 | + late final synthesized core::bool #0#4 = #0#0.{core::Map::containsKey}(#C2){(core::Object?) → core::bool}; |
| 82 | + late final synthesized dynamic #0#5 = #0#0.{core::Map::[]}(#C2){(core::Object?) → dynamic}; |
| 83 | + if(#0#3 && #0#4 && #C3 =={core::String::==}{(core::Object) → core::bool} #0#5{core::String}) { |
| 84 | + { |
| 85 | + return 0; |
| 86 | + } |
| 87 | + } |
| 88 | + else |
| 89 | + if(#0#3 && #0#4 && #C4 =={core::String::==}{(core::Object) → core::bool} #0#5{core::String}) { |
| 90 | + { |
| 91 | + return 1; |
| 92 | + } |
| 93 | + } |
| 94 | + } |
| 95 | + return 2; |
| 96 | +} |
| 97 | +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 { |
| 98 | + self::MyMap<core::int, core::String> myMap = new self::MyMap::•<core::int, core::String>(map); |
| 99 | + self::expect(expectedValue, self::method(myMap), "Unexpected value for ${map}."); |
| 100 | + self::expect(expectedContainsKeyCount, myMap.{self::MyMap::containsKeyCount}{core::int}, "Unexpected containsKey count for ${map}."); |
| 101 | + self::expect(expectedIndexGetCount, myMap.{self::MyMap::indexGetCount}{core::int}, "Unexpected indexGet count for ${map}."); |
| 102 | +} |
| 103 | +static method main() → dynamic { |
| 104 | + self::test(<core::int, core::String>{0: "foo"}, expectedValue: 2, expectedContainsKeyCount: 1, expectedIndexGetCount: 0); |
| 105 | + self::test(<core::int, core::String>{1: "foo"}, expectedValue: 0, expectedContainsKeyCount: 1, expectedIndexGetCount: 1); |
| 106 | + self::test(<core::int, core::String>{1: "bar"}, expectedValue: 1, expectedContainsKeyCount: 1, expectedIndexGetCount: 1); |
| 107 | + self::test(<core::int, core::String>{1: "baz"}, expectedValue: 2, expectedContainsKeyCount: 1, expectedIndexGetCount: 1); |
| 108 | +} |
| 109 | +static method expect(dynamic expected, dynamic actual, dynamic message) → dynamic { |
| 110 | + if(!(expected =={core::Object::==}{(core::Object) → core::bool} actual)) |
| 111 | + throw "${message} Expected ${expected}, actual ${actual}"; |
| 112 | +} |
| 113 | + |
| 114 | +constants { |
| 115 | + #C1 = null |
| 116 | + #C2 = 1 |
| 117 | + #C3 = "foo" |
| 118 | + #C4 = "bar" |
| 119 | +} |
0 commit comments