Skip to content

Commit 91426a8

Browse files
committed
fix: remove one more use of for..of
1 parent 043b8c6 commit 91426a8

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

modules/angular2/src/change_detection/parser/context_with_variable_bindings.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export class ContextWithVariableBindings {
3131
}
3232

3333
clearValues() {
34-
for (var k of MapWrapper.keys(this.varBindings)) {
35-
MapWrapper.set(this.varBindings, k, null);
36-
}
34+
MapWrapper.clearValues(this.varBindings);
3735
}
3836
}

modules/angular2/src/facade/collection.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ class MapWrapper {
5252
static void clear(Map m) {
5353
m.clear();
5454
}
55+
static void clearValues(Map m) {
56+
for (var k in m.keys) {
57+
m[k] = null;
58+
}
59+
}
5560
static Iterable iterable(Map m) => new IterableMap(m);
5661
static Iterable keys(Map m) => m.keys;
5762
static Iterable values(Map m) => m.values;

modules/angular2/src/facade/collection.es6

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ export class MapWrapper {
2525
static size(m) {return m.size;}
2626
static delete(m, k) { m.delete(k); }
2727
static clear(m) { m.clear(); }
28+
static clearValues(m) {
29+
var keyIterator = m.keys();
30+
var k;
31+
while (!((k = keyIterator.next()).done)) {
32+
m.set(k.value, null);
33+
}
34+
}
2835
static iterable(m) { return m; }
2936
static keys(m) { return m.keys(); }
3037
static values(m) { return m.values(); }

0 commit comments

Comments
 (0)