refactor(MapWrapper): drop delete(), get(), forEach() and size

Closes #4618
This commit is contained in:
Victor Berchet
2015-10-08 16:01:18 -07:00
parent aab0c57aee
commit a8c34ae290
22 changed files with 51 additions and 73 deletions

View File

@ -83,7 +83,7 @@ export class CodegenNameUtil {
getLocalName(idx: number): string { return `l_${this._sanitizedNames[idx]}`; }
getEventLocalName(eb: EventBinding, idx: number): string {
return `l_${MapWrapper.get(this._sanitizedEventNames, eb)[idx]}`;
return `l_${this._sanitizedEventNames.get(eb)[idx]}`;
}
getChangeName(idx: number): string { return `c_${this._sanitizedNames[idx]}`; }
@ -118,7 +118,7 @@ export class CodegenNameUtil {
*/
genInitEventLocals(): string {
var res = [`${this.getLocalName(CONTEXT_INDEX)} = ${this.getFieldName(CONTEXT_INDEX)}`];
MapWrapper.forEach(this._sanitizedEventNames, (names, eb) => {
this._sanitizedEventNames.forEach((names, eb) => {
for (var i = 0; i < names.length; ++i) {
if (i !== CONTEXT_INDEX) {
res.push(`${this.getEventLocalName(eb, i)}`);

View File

@ -608,12 +608,12 @@ class _DuplicateMap {
var recordList: _DuplicateItemRecordList = this.map.get(key);
// Remove the list of duplicates when it gets empty
if (recordList.remove(record)) {
MapWrapper.delete(this.map, key);
this.map.delete(key);
}
return record;
}
get isEmpty(): boolean { return MapWrapper.size(this.map) === 0; }
get isEmpty(): boolean { return this.map.size === 0; }
clear() { this.map.clear(); }

View File

@ -1,4 +1,4 @@
import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
import {MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
import {stringify, looseIdentical, isJsObject, CONST, isBlank} from 'angular2/src/core/facade/lang';
import {BaseException} from 'angular2/src/core/facade/exceptions';
import {ChangeDetectorRef} from '../change_detector_ref';
@ -197,7 +197,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
for (var rec: KVChangeRecord = this._removalsHead; rec !== null; rec = rec._nextRemoved) {
rec.previousValue = rec.currentValue;
rec.currentValue = null;
MapWrapper.delete(this._records, rec.key);
this._records.delete(rec.key);
}
}
@ -317,7 +317,7 @@ export class DefaultKeyValueDiffer implements KeyValueDiffer {
_forEach(obj, fn: Function) {
if (obj instanceof Map) {
MapWrapper.forEach(obj, fn);
(<Map<any, any>>obj).forEach(<any>fn);
} else {
StringMapWrapper.forEach(obj, fn);
}