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

Unified Diff: lib/runtime/dart/collection.js

Issue 1316723003: implement null aware ops, fixes #249 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 4 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 | « lib/runtime/dart/async.js ('k') | lib/runtime/dart/convert.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart/collection.js
diff --git a/lib/runtime/dart/collection.js b/lib/runtime/dart/collection.js
index 47ef242e29a87fa1917bac23dbb5c3937987fd15..c24f062251c865225c9bda8cb7bd42319f5c0f76 100644
--- a/lib/runtime/dart/collection.js
+++ b/lib/runtime/dart/collection.js
@@ -2290,6 +2290,7 @@ dart_library.library('dart/collection', null, /* Imports */[
dart.as(key, K);
dart.as(value, V);
dart.throw(new core.UnsupportedError("Cannot modify unmodifiable map"));
+ return value;
}
addAll(other) {
dart.as(other, core.Map$(K, V));
@@ -2414,6 +2415,7 @@ dart_library.library('dart/collection', null, /* Imports */[
dart.as(key, K);
dart.as(value, V);
this[_map].set(key, value);
+ return value;
}
addAll(other) {
dart.as(other, core.Map$(K, V));
@@ -3324,8 +3326,8 @@ dart_library.library('dart/collection', null, /* Imports */[
let _root = Symbol('_root');
let _count = Symbol('_count');
let _splayCount = Symbol('_splayCount');
- let _splay = Symbol('_splay');
let _compare = Symbol('_compare');
+ let _splay = Symbol('_splay');
let _splayMin = Symbol('_splayMin');
let _splayMax = Symbol('_splayMax');
let _addNewRoot = Symbol('_addNewRoot');
@@ -3561,17 +3563,20 @@ dart_library.library('dart/collection', null, /* Imports */[
return null;
}
set(key, value) {
- dart.as(key, K);
- dart.as(value, V);
- if (key == null)
- dart.throw(new core.ArgumentError(key));
- let comp = this[_splay](key);
- if (comp == 0) {
- let mapRoot = dart.as(this[_root], _SplayTreeMapNode);
- mapRoot.value = value;
- return;
- }
- this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value), comp);
+ ((() => {
+ dart.as(key, K);
+ dart.as(value, V);
+ if (key == null)
+ dart.throw(new core.ArgumentError(key));
+ let comp = this[_splay](key);
+ if (comp == 0) {
+ let mapRoot = dart.as(this[_root], _SplayTreeMapNode);
+ mapRoot.value = value;
+ return;
+ }
+ this[_addNewRoot](new (_SplayTreeMapNode$(K, dart.dynamic))(key, value), comp);
+ }).bind(this))();
+ return value;
}
putIfAbsent(key, ifAbsent) {
dart.as(key, K);
@@ -4227,6 +4232,7 @@ dart_library.library('dart/collection', null, /* Imports */[
} else {
this[_set](key, value);
}
+ return value;
}
[_set](key, value) {
dart.as(key, K);
@@ -4489,6 +4495,7 @@ dart_library.library('dart/collection', null, /* Imports */[
dart.as(key, K);
dart.as(value, V);
super[_set](key, value);
+ return value;
}
containsKey(key) {
if (!dart.notNull(this[_validKey](key)))
@@ -4718,6 +4725,7 @@ dart_library.library('dart/collection', null, /* Imports */[
} else {
this[_set](key, value);
}
+ return value;
}
[_set](key, value) {
dart.as(key, K);
@@ -4970,6 +4978,7 @@ dart_library.library('dart/collection', null, /* Imports */[
dart.as(key, K);
dart.as(value, V);
super[_set](key, value);
+ return value;
}
containsKey(key) {
if (!dart.notNull(this[_validKey](key)))
« no previous file with comments | « lib/runtime/dart/async.js ('k') | lib/runtime/dart/convert.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698