fix: remove one more use of for..of

This commit is contained in:
Alex Eagle 2015-02-27 15:43:10 -08:00
parent 043b8c6d2e
commit 91426a8efe
3 changed files with 13 additions and 3 deletions

View File

@ -31,8 +31,6 @@ export class ContextWithVariableBindings {
}
clearValues() {
for (var k of MapWrapper.keys(this.varBindings)) {
MapWrapper.set(this.varBindings, k, null);
}
MapWrapper.clearValues(this.varBindings);
}
}

View File

@ -52,6 +52,11 @@ class MapWrapper {
static void clear(Map m) {
m.clear();
}
static void clearValues(Map m) {
for (var k in m.keys) {
m[k] = null;
}
}
static Iterable iterable(Map m) => new IterableMap(m);
static Iterable keys(Map m) => m.keys;
static Iterable values(Map m) => m.values;

View File

@ -25,6 +25,13 @@ export class MapWrapper {
static size(m) {return m.size;}
static delete(m, k) { m.delete(k); }
static clear(m) { m.clear(); }
static clearValues(m) {
var keyIterator = m.keys();
var k;
while (!((k = keyIterator.next()).done)) {
m.set(k.value, null);
}
}
static iterable(m) { return m; }
static keys(m) { return m.keys(); }
static values(m) { return m.values(); }