Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Unified Diff: sdk/lib/_internal/js_runtime/lib/convert_patch.dart

Issue 1980663002: Make json-maps implement Map<String, dynamic>. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Changelog and test updates Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/convert_patch.dart ('k') | tests/corelib/json_map_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/convert_patch.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/convert_patch.dart b/sdk/lib/_internal/js_runtime/lib/convert_patch.dart
index 241d18e7a887d41849e1e0b7bd5bf9f786f67cfa..e88ac32b3ad3c482dfb165a0170045684b280384 100644
--- a/sdk/lib/_internal/js_runtime/lib/convert_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/convert_patch.dart
@@ -123,7 +123,7 @@ _convertJsonToDartLazy(object) {
return object;
}
-class _JsonMap implements LinkedHashMap {
+class _JsonMap implements Map<String, dynamic> {
// The original JavaScript object remains unchanged until
// the map is eventually upgraded, in which case we null it
// out to reclaim the memory used by it.
@@ -156,7 +156,7 @@ class _JsonMap implements LinkedHashMap {
bool get isEmpty => length == 0;
bool get isNotEmpty => length > 0;
- Iterable get keys {
+ Iterable<String> get keys {
if (_isUpgraded) return _upgradedMap.keys;
return new _JsonMapKeyIterable(this);
}
@@ -280,12 +280,12 @@ class _JsonMap implements LinkedHashMap {
return JS('JSExtendableArray', '#', keys);
}
- Map _upgrade() {
+ Map<String, dynamic> _upgrade() {
if (_isUpgraded) return _upgradedMap;
// Copy all the (key, value) pairs to a freshly allocated
// linked hash map thus preserving the ordering.
- Map result = {};
+ Map result = <String, dynamic>{};
List<String> keys = _computeKeys();
for (int i = 0; i < keys.length; i++) {
String key = keys[i];
@@ -331,7 +331,7 @@ class _JsonMap implements LinkedHashMap {
static _newJavaScriptObject() => JS('=Object', 'Object.create(null)');
}
-class _JsonMapKeyIterable extends ListIterable {
+class _JsonMapKeyIterable extends ListIterable<String> {
final _JsonMap _parent;
_JsonMapKeyIterable(this._parent);
@@ -347,7 +347,7 @@ class _JsonMapKeyIterable extends ListIterable {
/// Although [ListIterable] defines its own iterator, we return the iterator
/// of the underlying list [_keys] in order to propagate
/// [ConcurrentModificationError]s.
- Iterator get iterator {
+ Iterator<String> get iterator {
return _parent._isUpgraded
? _parent.keys.iterator
: _parent._computeKeys().iterator;
« no previous file with comments | « runtime/lib/convert_patch.dart ('k') | tests/corelib/json_map_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698