refactor(MapWrapper): drop delete(), get(), forEach() and size
Closes #4618
This commit is contained in:
parent
aab0c57aee
commit
a8c34ae290
|
@ -83,7 +83,7 @@ export class CodegenNameUtil {
|
||||||
getLocalName(idx: number): string { return `l_${this._sanitizedNames[idx]}`; }
|
getLocalName(idx: number): string { return `l_${this._sanitizedNames[idx]}`; }
|
||||||
|
|
||||||
getEventLocalName(eb: EventBinding, idx: number): string {
|
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]}`; }
|
getChangeName(idx: number): string { return `c_${this._sanitizedNames[idx]}`; }
|
||||||
|
@ -118,7 +118,7 @@ export class CodegenNameUtil {
|
||||||
*/
|
*/
|
||||||
genInitEventLocals(): string {
|
genInitEventLocals(): string {
|
||||||
var res = [`${this.getLocalName(CONTEXT_INDEX)} = ${this.getFieldName(CONTEXT_INDEX)}`];
|
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) {
|
for (var i = 0; i < names.length; ++i) {
|
||||||
if (i !== CONTEXT_INDEX) {
|
if (i !== CONTEXT_INDEX) {
|
||||||
res.push(`${this.getEventLocalName(eb, i)}`);
|
res.push(`${this.getEventLocalName(eb, i)}`);
|
||||||
|
|
|
@ -608,12 +608,12 @@ class _DuplicateMap {
|
||||||
var recordList: _DuplicateItemRecordList = this.map.get(key);
|
var recordList: _DuplicateItemRecordList = this.map.get(key);
|
||||||
// Remove the list of duplicates when it gets empty
|
// Remove the list of duplicates when it gets empty
|
||||||
if (recordList.remove(record)) {
|
if (recordList.remove(record)) {
|
||||||
MapWrapper.delete(this.map, key);
|
this.map.delete(key);
|
||||||
}
|
}
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
get isEmpty(): boolean { return MapWrapper.size(this.map) === 0; }
|
get isEmpty(): boolean { return this.map.size === 0; }
|
||||||
|
|
||||||
clear() { this.map.clear(); }
|
clear() { this.map.clear(); }
|
||||||
|
|
||||||
|
|
|
@ -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 {stringify, looseIdentical, isJsObject, CONST, isBlank} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {ChangeDetectorRef} from '../change_detector_ref';
|
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) {
|
for (var rec: KVChangeRecord = this._removalsHead; rec !== null; rec = rec._nextRemoved) {
|
||||||
rec.previousValue = rec.currentValue;
|
rec.previousValue = rec.currentValue;
|
||||||
rec.currentValue = null;
|
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) {
|
_forEach(obj, fn: Function) {
|
||||||
if (obj instanceof Map) {
|
if (obj instanceof Map) {
|
||||||
MapWrapper.forEach(obj, fn);
|
(<Map<any, any>>obj).forEach(<any>fn);
|
||||||
} else {
|
} else {
|
||||||
StringMapWrapper.forEach(obj, fn);
|
StringMapWrapper.forEach(obj, fn);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,8 @@ export class DebugElementViewListener implements AppViewListener {
|
||||||
|
|
||||||
viewDestroyed(view: AppView) {
|
viewDestroyed(view: AppView) {
|
||||||
var viewId = _allIdsByView.get(view);
|
var viewId = _allIdsByView.get(view);
|
||||||
MapWrapper.delete(_allIdsByView, view);
|
_allIdsByView.delete(view);
|
||||||
MapWrapper.delete(_allViewsById, viewId);
|
_allViewsById.delete(viewId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {MapWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
import {stringify, CONST, Type, isBlank} from 'angular2/src/core/facade/lang';
|
import {stringify, CONST, Type, isBlank} from 'angular2/src/core/facade/lang';
|
||||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||||
import {TypeLiteral} from './type_literal';
|
import {TypeLiteral} from './type_literal';
|
||||||
|
@ -70,7 +69,7 @@ export class KeyRegistry {
|
||||||
return newKey;
|
return newKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
get numberOfKeys(): number { return MapWrapper.size(this._allKeys); }
|
get numberOfKeys(): number { return this._allKeys.size; }
|
||||||
}
|
}
|
||||||
|
|
||||||
var _globalKeyRegistry = new KeyRegistry();
|
var _globalKeyRegistry = new KeyRegistry();
|
||||||
|
|
|
@ -45,15 +45,6 @@ class MapWrapper {
|
||||||
m[p[0]] = p[1];
|
m[p[0]] = p[1];
|
||||||
return m;
|
return m;
|
||||||
});
|
});
|
||||||
static forEach(Map m, fn(v, k)) {
|
|
||||||
m.forEach((k, v) => fn(v, k));
|
|
||||||
}
|
|
||||||
|
|
||||||
static get(Map map, key) => map[key];
|
|
||||||
static int size(Map m) => m.length;
|
|
||||||
static void delete(Map m, k) {
|
|
||||||
m.remove(k);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void clearValues(Map m) {
|
static void clearValues(Map m) {
|
||||||
for (var k in m.keys) {
|
for (var k in m.keys) {
|
||||||
|
|
|
@ -91,10 +91,6 @@ export class MapWrapper {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
static createFromPairs(pairs: any[]): Map<any, any> { return createMapFromPairs(pairs); }
|
static createFromPairs(pairs: any[]): Map<any, any> { return createMapFromPairs(pairs); }
|
||||||
static forEach<K, V>(m: Map<K, V>, fn: /*(V, K) => void*/ Function) { m.forEach(<any>fn); }
|
|
||||||
static get<K, V>(map: Map<K, V>, key: K): V { return map.get(key); }
|
|
||||||
static size(m: Map<any, any>): number { return m.size; }
|
|
||||||
static delete<K>(m: Map<K, any>, k: K) { m.delete(k); }
|
|
||||||
static clearValues(m: Map<any, any>) { _clearValues(m); }
|
static clearValues(m: Map<any, any>) { _clearValues(m); }
|
||||||
static iterable<T>(m: T): T { return m; }
|
static iterable<T>(m: T): T { return m; }
|
||||||
static keys<K>(m: Map<K, any>): K[] { return _arrayFromMap(m, false); }
|
static keys<K>(m: Map<K, any>): K[] { return _arrayFromMap(m, false); }
|
||||||
|
|
|
@ -336,8 +336,8 @@ export class AppProtoView {
|
||||||
this.variableLocations = variableLocations;
|
this.variableLocations = variableLocations;
|
||||||
this.protoLocals = new Map<string, any>();
|
this.protoLocals = new Map<string, any>();
|
||||||
if (isPresent(this.templateVariableBindings)) {
|
if (isPresent(this.templateVariableBindings)) {
|
||||||
MapWrapper.forEach(this.templateVariableBindings,
|
this.templateVariableBindings.forEach(
|
||||||
(templateName, _) => { this.protoLocals.set(templateName, null); });
|
(templateName, _) => { this.protoLocals.set(templateName, null); });
|
||||||
}
|
}
|
||||||
if (isPresent(variableLocations)) {
|
if (isPresent(variableLocations)) {
|
||||||
// The view's locals needs to have a full set of variable names at construction time
|
// The view's locals needs to have a full set of variable names at construction time
|
||||||
|
@ -345,8 +345,7 @@ export class AppProtoView {
|
||||||
// want
|
// want
|
||||||
// to actually create variable bindings for the $implicit bindings, add to the
|
// to actually create variable bindings for the $implicit bindings, add to the
|
||||||
// protoLocals manually.
|
// protoLocals manually.
|
||||||
MapWrapper.forEach(variableLocations,
|
variableLocations.forEach((_, templateName) => { this.protoLocals.set(templateName, null); });
|
||||||
(_, templateName) => { this.protoLocals.set(templateName, null); });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ export class AppViewManagerUtils {
|
||||||
_populateViewLocals(view: viewModule.AppView, elementInjector: eli.ElementInjector,
|
_populateViewLocals(view: viewModule.AppView, elementInjector: eli.ElementInjector,
|
||||||
boundElementIdx: number): void {
|
boundElementIdx: number): void {
|
||||||
if (isPresent(elementInjector.getDirectiveVariableBindings())) {
|
if (isPresent(elementInjector.getDirectiveVariableBindings())) {
|
||||||
MapWrapper.forEach(elementInjector.getDirectiveVariableBindings(), (directiveIndex, name) => {
|
elementInjector.getDirectiveVariableBindings().forEach((directiveIndex, name) => {
|
||||||
if (isBlank(directiveIndex)) {
|
if (isBlank(directiveIndex)) {
|
||||||
view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement);
|
view.locals.set(name, view.elementRefs[boundElementIdx].nativeElement);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -64,7 +64,7 @@ export class XHRConnection implements Connection {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isPresent(req.headers)) {
|
if (isPresent(req.headers)) {
|
||||||
req.headers.forEach((values, name) => { _xhr.setRequestHeader(name, values.join(',')); });
|
req.headers.forEach((values, name) => _xhr.setRequestHeader(name, values.join(',')));
|
||||||
}
|
}
|
||||||
|
|
||||||
_xhr.addEventListener('load', onLoad);
|
_xhr.addEventListener('load', onLoad);
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
isListLikeIterable,
|
isListLikeIterable,
|
||||||
Map,
|
Map,
|
||||||
MapWrapper,
|
MapWrapper,
|
||||||
|
StringMapWrapper,
|
||||||
ListWrapper,
|
ListWrapper,
|
||||||
} from 'angular2/src/core/facade/collection';
|
} from 'angular2/src/core/facade/collection';
|
||||||
|
|
||||||
|
@ -36,23 +37,20 @@ import {
|
||||||
export class Headers {
|
export class Headers {
|
||||||
_headersMap: Map<string, string[]>;
|
_headersMap: Map<string, string[]>;
|
||||||
constructor(headers?: Headers | {[key: string]: any}) {
|
constructor(headers?: Headers | {[key: string]: any}) {
|
||||||
if (isBlank(headers)) {
|
if (headers instanceof Headers) {
|
||||||
this._headersMap = new Map<string, string[]>();
|
this._headersMap = (<Headers>headers)._headersMap;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (headers instanceof Headers) {
|
this._headersMap = new Map<string, string[]>();
|
||||||
this._headersMap = (<Headers>headers)._headersMap;
|
|
||||||
} else /*if (headers instanceof StringMap)*/ {
|
if (isBlank(headers)) {
|
||||||
this._headersMap = MapWrapper.createFromStringMap<string[]>(<{[key: string]: any}>headers);
|
return;
|
||||||
MapWrapper.forEach(this._headersMap, (v, k) => {
|
|
||||||
if (!isListLikeIterable(v)) {
|
|
||||||
var list = [];
|
|
||||||
list.push(v);
|
|
||||||
this._headersMap.set(k, list);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// headers instanceof StringMap
|
||||||
|
StringMapWrapper.forEach(
|
||||||
|
headers, (v, k) => { this._headersMap.set(k, isListLikeIterable(v) ? v : [v]); });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,10 +66,10 @@ export class Headers {
|
||||||
/**
|
/**
|
||||||
* Deletes all header values for the given name.
|
* Deletes all header values for the given name.
|
||||||
*/
|
*/
|
||||||
delete (name: string): void { MapWrapper.delete(this._headersMap, name); }
|
delete (name: string): void { this._headersMap.delete(name); }
|
||||||
|
|
||||||
forEach(fn: (values: string[], name: string, headers: Map<string, string[]>) => void): void {
|
forEach(fn: (values: string[], name: string, headers: Map<string, string[]>) => void): void {
|
||||||
MapWrapper.forEach(this._headersMap, fn);
|
this._headersMap.forEach(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -71,7 +71,7 @@ export class URLSearchParams {
|
||||||
//
|
//
|
||||||
// TODO(@caitp): document this better
|
// TODO(@caitp): document this better
|
||||||
setAll(searchParams: URLSearchParams) {
|
setAll(searchParams: URLSearchParams) {
|
||||||
MapWrapper.forEach(searchParams.paramsMap, (value, param) => {
|
searchParams.paramsMap.forEach((value, param) => {
|
||||||
var mapParam = this.paramsMap.get(param);
|
var mapParam = this.paramsMap.get(param);
|
||||||
var list = isPresent(mapParam) ? mapParam : [];
|
var list = isPresent(mapParam) ? mapParam : [];
|
||||||
ListWrapper.clear(list);
|
ListWrapper.clear(list);
|
||||||
|
@ -95,7 +95,7 @@ export class URLSearchParams {
|
||||||
//
|
//
|
||||||
// TODO(@caitp): document this better
|
// TODO(@caitp): document this better
|
||||||
appendAll(searchParams: URLSearchParams) {
|
appendAll(searchParams: URLSearchParams) {
|
||||||
MapWrapper.forEach(searchParams.paramsMap, (value, param) => {
|
searchParams.paramsMap.forEach((value, param) => {
|
||||||
var mapParam = this.paramsMap.get(param);
|
var mapParam = this.paramsMap.get(param);
|
||||||
var list = isPresent(mapParam) ? mapParam : [];
|
var list = isPresent(mapParam) ? mapParam : [];
|
||||||
for (var i = 0; i < value.length; ++i) {
|
for (var i = 0; i < value.length; ++i) {
|
||||||
|
@ -114,7 +114,7 @@ export class URLSearchParams {
|
||||||
//
|
//
|
||||||
// TODO(@caitp): document this better
|
// TODO(@caitp): document this better
|
||||||
replaceAll(searchParams: URLSearchParams) {
|
replaceAll(searchParams: URLSearchParams) {
|
||||||
MapWrapper.forEach(searchParams.paramsMap, (value, param) => {
|
searchParams.paramsMap.forEach((value, param) => {
|
||||||
var mapParam = this.paramsMap.get(param);
|
var mapParam = this.paramsMap.get(param);
|
||||||
var list = isPresent(mapParam) ? mapParam : [];
|
var list = isPresent(mapParam) ? mapParam : [];
|
||||||
ListWrapper.clear(list);
|
ListWrapper.clear(list);
|
||||||
|
@ -127,10 +127,9 @@ export class URLSearchParams {
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
var paramsList = [];
|
var paramsList = [];
|
||||||
MapWrapper.forEach(this.paramsMap,
|
this.paramsMap.forEach((values, k) => { values.forEach(v => paramsList.push(k + '=' + v)); });
|
||||||
(values, k) => { values.forEach(v => paramsList.push(k + '=' + v)); });
|
|
||||||
return paramsList.join('&');
|
return paramsList.join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
delete (param: string): void { MapWrapper.delete(this.paramsMap, param); }
|
delete (param: string): void { this.paramsMap.delete(param); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ export class MockViewResolver extends ViewResolver {
|
||||||
|
|
||||||
if (isPresent(overrides) && isPresent(directives)) {
|
if (isPresent(overrides) && isPresent(directives)) {
|
||||||
directives = ListWrapper.clone(view.directives);
|
directives = ListWrapper.clone(view.directives);
|
||||||
MapWrapper.forEach(overrides, (to, from) => {
|
overrides.forEach((to, from) => {
|
||||||
var srcIndex = directives.indexOf(from);
|
var srcIndex = directives.indexOf(from);
|
||||||
if (srcIndex == -1) {
|
if (srcIndex == -1) {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
|
|
|
@ -328,9 +328,8 @@ export class Router {
|
||||||
}
|
}
|
||||||
|
|
||||||
var promises = [];
|
var promises = [];
|
||||||
MapWrapper.forEach(this._auxRouters, (router, name) => {
|
this._auxRouters.forEach(
|
||||||
promises.push(router.commit(instruction.auxInstruction[name]));
|
(router, name) => { promises.push(router.commit(instruction.auxInstruction[name])); });
|
||||||
});
|
|
||||||
|
|
||||||
return next.then((_) => PromiseWrapper.all(promises));
|
return next.then((_) => PromiseWrapper.all(promises));
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,14 +169,12 @@ export class TestComponentBuilder {
|
||||||
createAsync(rootComponentType: Type): Promise<RootTestComponent> {
|
createAsync(rootComponentType: Type): Promise<RootTestComponent> {
|
||||||
var mockDirectiveResolver = this._injector.get(DirectiveResolver);
|
var mockDirectiveResolver = this._injector.get(DirectiveResolver);
|
||||||
var mockViewResolver = this._injector.get(ViewResolver);
|
var mockViewResolver = this._injector.get(ViewResolver);
|
||||||
MapWrapper.forEach(this._viewOverrides,
|
this._viewOverrides.forEach((view, type) => mockViewResolver.setView(type, view));
|
||||||
(view, type) => { mockViewResolver.setView(type, view); });
|
this._templateOverrides.forEach((template, type) =>
|
||||||
MapWrapper.forEach(this._templateOverrides,
|
mockViewResolver.setInlineTemplate(type, template));
|
||||||
(template, type) => { mockViewResolver.setInlineTemplate(type, template); });
|
this._directiveOverrides.forEach((overrides, component) => {
|
||||||
MapWrapper.forEach(this._directiveOverrides, (overrides, component) => {
|
overrides.forEach(
|
||||||
MapWrapper.forEach(overrides, (to, from) => {
|
(to, from) => { mockViewResolver.overrideViewDirective(component, from, to); });
|
||||||
mockViewResolver.overrideViewDirective(component, from, to);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this._bindingsOverrides.forEach((bindings, type) =>
|
this._bindingsOverrides.forEach((bindings, type) =>
|
||||||
|
|
|
@ -105,7 +105,7 @@ export function stringifyElement(el): string {
|
||||||
// Attributes in an ordered way
|
// Attributes in an ordered way
|
||||||
var attributeMap = DOM.attributeMap(el);
|
var attributeMap = DOM.attributeMap(el);
|
||||||
var keys = [];
|
var keys = [];
|
||||||
MapWrapper.forEach(attributeMap, (v, k) => { keys.push(k); });
|
attributeMap.forEach((v, k) => keys.push(k));
|
||||||
ListWrapper.sort(keys);
|
ListWrapper.sort(keys);
|
||||||
for (let i = 0; i < keys.length; i++) {
|
for (let i = 0; i < keys.length; i++) {
|
||||||
var key = keys[i];
|
var key = keys[i];
|
||||||
|
|
|
@ -54,13 +54,13 @@ export class RenderViewWithFragmentsStore {
|
||||||
this._removeRef(view);
|
this._removeRef(view);
|
||||||
var fragments = this._viewFragments.get(view);
|
var fragments = this._viewFragments.get(view);
|
||||||
fragments.forEach((fragment) => { this._removeRef(fragment); });
|
fragments.forEach((fragment) => { this._removeRef(fragment); });
|
||||||
MapWrapper.delete(this._viewFragments, view);
|
this._viewFragments.delete(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _removeRef(ref: RenderViewRef | RenderFragmentRef) {
|
private _removeRef(ref: RenderViewRef | RenderFragmentRef) {
|
||||||
var index = this._lookupByView.get(ref);
|
var index = this._lookupByView.get(ref);
|
||||||
MapWrapper.delete(this._lookupByView, ref);
|
this._lookupByView.delete(ref);
|
||||||
MapWrapper.delete(this._lookupByIndex, index);
|
this._lookupByIndex.delete(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
serializeRenderViewRef(viewRef: RenderViewRef): number {
|
serializeRenderViewRef(viewRef: RenderViewRef): number {
|
||||||
|
|
|
@ -104,7 +104,7 @@ export class Serializer {
|
||||||
var object = {};
|
var object = {};
|
||||||
var serialize = isPresent(type);
|
var serialize = isPresent(type);
|
||||||
|
|
||||||
MapWrapper.forEach(map, (value, key) => {
|
map.forEach((value, key) => {
|
||||||
if (serialize) {
|
if (serialize) {
|
||||||
object[key] = this.serialize(value, type);
|
object[key] = this.serialize(value, type);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -53,7 +53,7 @@ function _convertLocalsToVariableBindings(locals: Locals): any[] {
|
||||||
var variableBindings = [];
|
var variableBindings = [];
|
||||||
var loc = locals;
|
var loc = locals;
|
||||||
while (isPresent(loc) && isPresent(loc.current)) {
|
while (isPresent(loc) && isPresent(loc.current)) {
|
||||||
MapWrapper.forEach(loc.current, (v, k) => variableBindings.push(k));
|
loc.current.forEach((v, k) => variableBindings.push(k));
|
||||||
loc = loc.parent;
|
loc = loc.parent;
|
||||||
}
|
}
|
||||||
return variableBindings;
|
return variableBindings;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import {
|
||||||
DefaultKeyValueDifferFactory
|
DefaultKeyValueDifferFactory
|
||||||
} from 'angular2/src/core/change_detection/differs/default_keyvalue_differ';
|
} from 'angular2/src/core/change_detection/differs/default_keyvalue_differ';
|
||||||
import {NumberWrapper, isJsObject} from 'angular2/src/core/facade/lang';
|
import {NumberWrapper, isJsObject} from 'angular2/src/core/facade/lang';
|
||||||
import {MapWrapper} from 'angular2/src/core/facade/collection';
|
|
||||||
import {kvChangesAsString} from '../../../core/change_detection/util';
|
import {kvChangesAsString} from '../../../core/change_detection/util';
|
||||||
|
|
||||||
// todo(vicb): Update the code & tests for object equality
|
// todo(vicb): Update the code & tests for object equality
|
||||||
|
@ -95,7 +94,7 @@ export function main() {
|
||||||
changes: ['b[B->BB]']
|
changes: ['b[B->BB]']
|
||||||
}));
|
}));
|
||||||
|
|
||||||
MapWrapper.delete(m, 'b');
|
m.delete('b');
|
||||||
differ.check(m);
|
differ.check(m);
|
||||||
expect(differ.toString())
|
expect(differ.toString())
|
||||||
.toEqual(kvChangesAsString(
|
.toEqual(kvChangesAsString(
|
||||||
|
|
|
@ -102,7 +102,7 @@ class FakeEventManagerPlugin extends EventManagerPlugin {
|
||||||
|
|
||||||
addEventListener(element, eventName: string, handler: Function) {
|
addEventListener(element, eventName: string, handler: Function) {
|
||||||
this._eventHandler.set(eventName, handler);
|
this._eventHandler.set(eventName, handler);
|
||||||
return () => { MapWrapper.delete(this._eventHandler, eventName); };
|
return () => { this._eventHandler.delete(eventName); };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ export class RawEntity {
|
||||||
|
|
||||||
remove(key: string) {
|
remove(key: string) {
|
||||||
if (!StringWrapper.contains(key, '.')) {
|
if (!StringWrapper.contains(key, '.')) {
|
||||||
return MapWrapper.delete(this._data, key);
|
return this._data.delete(key);
|
||||||
}
|
}
|
||||||
var pieces = key.split('.');
|
var pieces = key.split('.');
|
||||||
var last = ListWrapper.last(pieces);
|
var last = ListWrapper.last(pieces);
|
||||||
|
|
Loading…
Reference in New Issue