mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:31:50 +00:00
cd53f4ffe1
Bug: https://github.com/dart-lang/sdk/issues/37931 Change-Id: I454ffd0cbd090d5f4ff0aa4f2a778710eea7c5b6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133860 Commit-Queue: Srujan Gaddam <srujzs@google.com> Reviewed-by: Sigmund Cherem <sigmund@google.com>
67 lines
1.8 KiB
Plaintext
67 lines
1.8 KiB
Plaintext
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
part of $LIBRARYNAME;
|
|
|
|
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$MIXINS$IMPLEMENTS {
|
|
$!MEMBERS
|
|
|
|
Map$NULLABLE _getItem($KEYTYPE key) =>
|
|
convertNativeToDart_Dictionary(JS('', '#.get(#)', this, key));
|
|
|
|
void addAll(Map<$KEYTYPE, $VALUETYPE> other) {
|
|
throw new UnsupportedError("Not supported");
|
|
}
|
|
|
|
bool containsValue($VALUETYPE value) => values.any((e) => e == value);
|
|
|
|
bool containsKey($VALUETYPE key) => _getItem(key) != null;
|
|
|
|
Map$NULLABLE operator []($VALUETYPE key) => _getItem(key);
|
|
|
|
void forEach(void f($KEYTYPE key, $VALUETYPE value)) {
|
|
var entries = JS('', '#.entries()', this);
|
|
while (true) {
|
|
var entry = JS('', '#.next()', entries);
|
|
if (JS('bool', '#.done', entry)) return;
|
|
f(JS('$KEYTYPE', '#.value[0]', entry),
|
|
convertNativeToDart_Dictionary(JS('', '#.value[1]', entry)));
|
|
}
|
|
}
|
|
|
|
Iterable<$KEYTYPE> get keys {
|
|
final keys = <$KEYTYPE>[];
|
|
forEach((k, v) => keys.add(k));
|
|
return keys;
|
|
}
|
|
|
|
Iterable<Map> get values {
|
|
final values = <Map>[];
|
|
forEach((k, v) => values.add(v));
|
|
return values;
|
|
}
|
|
|
|
int get length => JS('int', '#.size', this);
|
|
|
|
bool get isEmpty => length == 0;
|
|
|
|
bool get isNotEmpty => !isEmpty;
|
|
|
|
void operator []=($KEYTYPE key, $VALUETYPE value) {
|
|
throw new UnsupportedError("Not supported");
|
|
}
|
|
|
|
dynamic putIfAbsent($KEYTYPE key, $VALUETYPE ifAbsent()) {
|
|
throw new UnsupportedError("Not supported");
|
|
}
|
|
|
|
$KEYTYPE remove($VALUETYPE key) {
|
|
throw new UnsupportedError("Not supported");
|
|
}
|
|
|
|
void clear() {
|
|
throw new UnsupportedError("Not supported");
|
|
}
|
|
}
|