feat: remove MapWrapper.clear().

It's the same in Dart and JavaScript.
This commit is contained in:
Martin Probst 2015-06-18 09:59:51 -07:00
parent dfd30910aa
commit 941362014b
6 changed files with 6 additions and 10 deletions

View File

@ -621,7 +621,7 @@ class _DuplicateMap {
get isEmpty(): boolean { return MapWrapper.size(this.map) === 0; } get isEmpty(): boolean { return MapWrapper.size(this.map) === 0; }
clear() { MapWrapper.clear(this.map); } clear() { this.map.clear(); }
toString(): string { return '_DuplicateMap(' + stringify(this.map) + ')'; } toString(): string { return '_DuplicateMap(' + stringify(this.map) + ')'; }
} }

View File

@ -52,8 +52,8 @@ export class CompilerCache {
} }
clear(): void { clear(): void {
MapWrapper.clear(this._cache); this._cache.clear();
MapWrapper.clear(this._hostCache); this._hostCache.clear();
} }
} }

View File

@ -43,9 +43,6 @@ class MapWrapper {
static void delete(Map m, k) { static void delete(Map m, k) {
m.remove(k); m.remove(k);
} }
static void clear(Map m) {
m.clear();
}
static void clearValues(Map m) { static void clearValues(Map m) {
for (var k in m.keys) { for (var k in m.keys) {
m[k] = null; m[k] = null;

View File

@ -67,7 +67,6 @@ export class MapWrapper {
static forEach<K, V>(m: Map<K, V>, fn: /*(V, K) => void*/ Function) { m.forEach(<any>fn); } static forEach<K, V>(m: Map<K, V>, fn: /*(V, K) => void*/ Function) { m.forEach(<any>fn); }
static size(m: Map<any, any>) { return m.size; } static size(m: Map<any, any>) { return m.size; }
static delete<K>(m: Map<K, any>, k: K) { m.delete(k); } static delete<K>(m: Map<K, any>, k: K) { m.delete(k); }
static clear(m: Map<any, any>) { m.clear(); }
static clearValues(m: Map<any, any>) { _clearValues(m); } static clearValues(m: Map<any, any>) { _clearValues(m); }
static iterable(m) { return m; } static iterable(m) { return m; }
static keys<K>(m: Map<K, any>): List<K> { return m.keys(); } static keys<K>(m: Map<K, any>): List<K> { return m.keys(); }

View File

@ -60,8 +60,8 @@ export function shimCssForComponent(cssText: string, componentId: string): strin
// Reset the caches - used for tests only // Reset the caches - used for tests only
export function resetShadowDomCache() { export function resetShadowDomCache() {
MapWrapper.clear(_componentUIDs); _componentUIDs.clear();
_nextComponentUID = 0; _nextComponentUID = 0;
MapWrapper.clear(_sharedStyleTexts); _sharedStyleTexts.clear();
_lastInsertedStyleEl = null; _lastInsertedStyleEl = null;
} }

View File

@ -98,7 +98,7 @@ export function main() {
.toEqual(kvChangesAsString( .toEqual(kvChangesAsString(
{map: ['a', 'd'], previous: ['a', 'b[BB->null]', 'd'], removals: ['b[BB->null]']})); {map: ['a', 'd'], previous: ['a', 'b[BB->null]', 'd'], removals: ['b[BB->null]']}));
MapWrapper.clear(m); m.clear();
changes.check(m); changes.check(m);
expect(changes.toString()) expect(changes.toString())
.toEqual(kvChangesAsString( .toEqual(kvChangesAsString(