diff --git a/modules/angular2/src/change_detection/parser/locals.ts b/modules/angular2/src/change_detection/parser/locals.ts index b45ac4f569..d7f9ac0a11 100644 --- a/modules/angular2/src/change_detection/parser/locals.ts +++ b/modules/angular2/src/change_detection/parser/locals.ts @@ -5,7 +5,7 @@ export class Locals { constructor(public parent: Locals, public current: Map) {} contains(name: string): boolean { - if (MapWrapper.contains(this.current, name)) { + if (this.current.has(name)) { return true; } @@ -17,7 +17,7 @@ export class Locals { } get(name: string) { - if (MapWrapper.contains(this.current, name)) { + if (this.current.has(name)) { return this.current.get(name); } @@ -32,7 +32,7 @@ export class Locals { // TODO(rado): consider removing this check if we can guarantee this is not // exposed to the public API. // TODO: vsavkin maybe it should check only the local map - if (MapWrapper.contains(this.current, name)) { + if (this.current.has(name)) { this.current.set(name, value); } else { throw new BaseException( diff --git a/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts b/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts index e015a2bfde..f8d6b6e329 100644 --- a/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts +++ b/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts @@ -105,7 +105,7 @@ export class KeyValueChanges extends Pipe { this._removeFromSeq(lastOldSeqRecord, oldSeqRecord); this._addToRemovals(oldSeqRecord); } - if (MapWrapper.contains(records, key)) { + if (records.has(key)) { newSeqRecord = records.get(key); } else { newSeqRecord = new KVChangeRecord(key); diff --git a/modules/angular2/src/core/compiler/element_injector.ts b/modules/angular2/src/core/compiler/element_injector.ts index 970305ec68..a961debbaa 100644 --- a/modules/angular2/src/core/compiler/element_injector.ts +++ b/modules/angular2/src/core/compiler/element_injector.ts @@ -421,7 +421,7 @@ export class ProtoElementInjector { var visitedIds: Map = new Map(); ListWrapper.forEach(dirBindings, dirBinding => { ListWrapper.forEach(dirBinding.resolvedHostInjectables, b => { - if (MapWrapper.contains(visitedIds, b.key.id)) { + if (visitedIds.has(b.key.id)) { throw new BaseException( `Multiple directives defined the same host injectable: "${stringify(b.key.token)}"`); } @@ -730,7 +730,7 @@ export class ElementInjector extends TreeNode { hasVariableBinding(name: string): boolean { var vb = this._proto.directiveVariableBindings; - return isPresent(vb) && MapWrapper.contains(vb, name); + return isPresent(vb) && vb.has(name); } getVariableBinding(name: string): any { @@ -891,7 +891,7 @@ export class ElementInjector extends TreeNode { private _buildAttribute(dep: DirectiveDependency): string { var attributes = this._proto.attributes; - if (isPresent(attributes) && MapWrapper.contains(attributes, dep.attributeName)) { + if (isPresent(attributes) && attributes.has(dep.attributeName)) { return attributes.get(dep.attributeName); } else { return null; diff --git a/modules/angular2/src/core/compiler/proto_view_factory.ts b/modules/angular2/src/core/compiler/proto_view_factory.ts index 86094974f5..fb0ed81d64 100644 --- a/modules/angular2/src/core/compiler/proto_view_factory.ts +++ b/modules/angular2/src/core/compiler/proto_view_factory.ts @@ -115,7 +115,7 @@ class BindingRecordsCreator { directiveMetadata: renderApi.DirectiveMetadata): DirectiveRecord { var id = boundElementIndex * 100 + directiveIndex; - if (!MapWrapper.contains(this._directiveRecordsMap, id)) { + if (!this._directiveRecordsMap.has(id)) { this._directiveRecordsMap.set( id, new DirectiveRecord({ directiveIndex: new DirectiveIndex(boundElementIndex, directiveIndex), diff --git a/modules/angular2/src/core/compiler/view.ts b/modules/angular2/src/core/compiler/view.ts index 9ef1ca5aa7..82413b7fa6 100644 --- a/modules/angular2/src/core/compiler/view.ts +++ b/modules/angular2/src/core/compiler/view.ts @@ -73,7 +73,7 @@ export class AppView implements ChangeDispatcher, EventDispatcher { setLocal(contextName: string, value): void { if (!this.hydrated()) throw new BaseException('Cannot set locals on dehydrated view.'); - if (!MapWrapper.contains(this.proto.variableBindings, contextName)) { + if (!this.proto.variableBindings.has(contextName)) { return; } var templateName = this.proto.variableBindings.get(contextName); diff --git a/modules/angular2/src/core/testability/testability.ts b/modules/angular2/src/core/testability/testability.ts index 70eea10336..ff12895d97 100644 --- a/modules/angular2/src/core/testability/testability.ts +++ b/modules/angular2/src/core/testability/testability.ts @@ -71,7 +71,7 @@ export class TestabilityRegistry { if (elem == null) { return null; } - if (MapWrapper.contains(this._applications, elem)) { + if (this._applications.has(elem)) { return this._applications.get(elem); } if (DOM.isShadowRoot(elem)) { diff --git a/modules/angular2/src/di/key.ts b/modules/angular2/src/di/key.ts index d19358ab35..66298e8cd1 100644 --- a/modules/angular2/src/di/key.ts +++ b/modules/angular2/src/di/key.ts @@ -56,7 +56,7 @@ export class KeyRegistry { } token = theToken; - if (MapWrapper.contains(this._allKeys, token)) { + if (this._allKeys.has(token)) { return this._allKeys.get(token); } diff --git a/modules/angular2/src/facade/collection.dart b/modules/angular2/src/facade/collection.dart index 099dd1efe9..3cb396eca6 100644 --- a/modules/angular2/src/facade/collection.dart +++ b/modules/angular2/src/facade/collection.dart @@ -36,7 +36,6 @@ class MapWrapper { m[p[0]] = p[1]; return m; }); - static contains(Map m, k) => m.containsKey(k); static forEach(Map m, fn(v, k)) { m.forEach((k, v) => fn(v, k)); } diff --git a/modules/angular2/src/facade/collection.ts b/modules/angular2/src/facade/collection.ts index 48a21268ca..a28eb7f240 100644 --- a/modules/angular2/src/facade/collection.ts +++ b/modules/angular2/src/facade/collection.ts @@ -64,7 +64,6 @@ export class MapWrapper { return result; } static createFromPairs(pairs: List): Map { return createMapFromPairs(pairs); } - static contains(m: Map, k: K) { return m.has(k); } static forEach(m: Map, fn: /*(V, K) => void*/ Function) { m.forEach(fn); } static size(m: Map) { return m.size; } static delete(m: Map, k: K) { m.delete(k); } diff --git a/modules/angular2/src/http/headers.ts b/modules/angular2/src/http/headers.ts index cf0c6efa0d..46b0bc1969 100644 --- a/modules/angular2/src/http/headers.ts +++ b/modules/angular2/src/http/headers.ts @@ -53,7 +53,7 @@ export class Headers { get(header: string): string { return ListWrapper.first(this._headersMap.get(header)); } - has(header: string) { return MapWrapper.contains(this._headersMap, header); } + has(header: string) { return this._headersMap.has(header); } keys() { return MapWrapper.keys(this._headersMap); } diff --git a/modules/angular2/src/http/url_search_params.ts b/modules/angular2/src/http/url_search_params.ts index becf9e88f4..69d8c6819d 100644 --- a/modules/angular2/src/http/url_search_params.ts +++ b/modules/angular2/src/http/url_search_params.ts @@ -19,7 +19,7 @@ export class URLSearchParams { paramsMap: Map>; constructor(public rawParams: string) { this.paramsMap = paramParser(rawParams); } - has(param: string): boolean { return MapWrapper.contains(this.paramsMap, param); } + has(param: string): boolean { return this.paramsMap.has(param); } get(param: string): string { return ListWrapper.first(this.paramsMap.get(param)); } diff --git a/modules/angular2/src/reflection/reflector.ts b/modules/angular2/src/reflection/reflector.ts index d27ab4fbf3..b6f91829cc 100644 --- a/modules/angular2/src/reflection/reflector.ts +++ b/modules/angular2/src/reflection/reflector.ts @@ -52,7 +52,7 @@ export class Reflector { } parameters(typeOrFunc): List { - if (MapWrapper.contains(this._typeInfo, typeOrFunc)) { + if (this._typeInfo.has(typeOrFunc)) { return this._getTypeInfoField(typeOrFunc, "parameters", []); } else { return this.reflectionCapabilities.parameters(typeOrFunc); @@ -60,7 +60,7 @@ export class Reflector { } annotations(typeOrFunc): List { - if (MapWrapper.contains(this._typeInfo, typeOrFunc)) { + if (this._typeInfo.has(typeOrFunc)) { return this._getTypeInfoField(typeOrFunc, "annotations", []); } else { return this.reflectionCapabilities.annotations(typeOrFunc); @@ -68,7 +68,7 @@ export class Reflector { } interfaces(type): List { - if (MapWrapper.contains(this._typeInfo, type)) { + if (this._typeInfo.has(type)) { return this._getTypeInfoField(type, "interfaces", []); } else { return this.reflectionCapabilities.interfaces(type); @@ -76,7 +76,7 @@ export class Reflector { } getter(name: string): GetterFn { - if (MapWrapper.contains(this._getters, name)) { + if (this._getters.has(name)) { return this._getters.get(name); } else { return this.reflectionCapabilities.getter(name); @@ -84,7 +84,7 @@ export class Reflector { } setter(name: string): SetterFn { - if (MapWrapper.contains(this._setters, name)) { + if (this._setters.has(name)) { return this._setters.get(name); } else { return this.reflectionCapabilities.setter(name); @@ -92,7 +92,7 @@ export class Reflector { } method(name: string): MethodFn { - if (MapWrapper.contains(this._methods, name)) { + if (this._methods.has(name)) { return this._methods.get(name); } else { return this.reflectionCapabilities.method(name); @@ -104,7 +104,7 @@ export class Reflector { return isPresent(res) ? res : defaultValue; } - _containsTypeInfo(typeOrFunc) { return MapWrapper.contains(this._typeInfo, typeOrFunc); } + _containsTypeInfo(typeOrFunc) { return this._typeInfo.has(typeOrFunc); } } function _mergeMaps(target: Map, config: StringMap): void { diff --git a/modules/angular2/src/render/dom/shadow_dom/util.ts b/modules/angular2/src/render/dom/shadow_dom/util.ts index bbb1e86250..779998f16a 100644 --- a/modules/angular2/src/render/dom/shadow_dom/util.ts +++ b/modules/angular2/src/render/dom/shadow_dom/util.ts @@ -20,7 +20,7 @@ export function getComponentId(componentStringId: string) { } export function insertSharedStyleText(cssText, styleHost, styleEl) { - if (!MapWrapper.contains(_sharedStyleTexts, cssText)) { + if (!_sharedStyleTexts.has(cssText)) { // Styles are unscoped and shared across components, only append them to the head // when there are not present yet _sharedStyleTexts.set(cssText, true); diff --git a/modules/angular2/src/render/xhr_mock.ts b/modules/angular2/src/render/xhr_mock.ts index 606f63acb8..4be22e7b0a 100644 --- a/modules/angular2/src/render/xhr_mock.ts +++ b/modules/angular2/src/render/xhr_mock.ts @@ -65,7 +65,7 @@ export class MockXHR extends XHR { } } - if (MapWrapper.contains(this._definitions, url)) { + if (this._definitions.has(url)) { var response = this._definitions.get(url); request.complete(normalizeBlank(response)); return; diff --git a/modules/angular2/src/router/route_recognizer.ts b/modules/angular2/src/router/route_recognizer.ts index 440d54f598..5df91aa439 100644 --- a/modules/angular2/src/router/route_recognizer.ts +++ b/modules/angular2/src/router/route_recognizer.ts @@ -90,7 +90,7 @@ export class RouteRecognizer { return solutions; } - hasRoute(name: string): boolean { return MapWrapper.contains(this.names, name); } + hasRoute(name: string): boolean { return this.names.has(name); } generate(name: string, params: any): string { var pathRecognizer = this.names.get(name); diff --git a/modules/angular2/src/router/route_registry.ts b/modules/angular2/src/router/route_registry.ts index 92a2de95e3..3b7a5e4ad4 100644 --- a/modules/angular2/src/router/route_registry.ts +++ b/modules/angular2/src/router/route_registry.ts @@ -69,7 +69,7 @@ export class RouteRegistry { // Don't read the annotations from a type more than once – // this prevents an infinite loop if a component routes recursively. - if (MapWrapper.contains(this._rules, component)) { + if (this._rules.has(component)) { return; } var annotations = reflector.annotations(component); diff --git a/modules/angular2/test/render/dom/compiler/pipeline_spec.ts b/modules/angular2/test/render/dom/compiler/pipeline_spec.ts index 522a49a77a..fa2197f4be 100644 --- a/modules/angular2/test/render/dom/compiler/pipeline_spec.ts +++ b/modules/angular2/test/render/dom/compiler/pipeline_spec.ts @@ -198,7 +198,7 @@ class MockStep implements CompileStep { export class IgnoreChildrenStep implements CompileStep { process(parent: CompileElement, current: CompileElement, control: CompileControl) { var attributeMap = DOM.attributeMap(current.element); - if (MapWrapper.contains(attributeMap, 'ignore-children')) { + if (attributeMap.has('ignore-children')) { current.compileChildren = false; } } @@ -207,7 +207,7 @@ export class IgnoreChildrenStep implements CompileStep { class IgnoreCurrentElementStep implements CompileStep { process(parent: CompileElement, current: CompileElement, control: CompileControl) { var attributeMap = DOM.attributeMap(current.element); - if (MapWrapper.contains(attributeMap, 'ignore-current')) { + if (attributeMap.has('ignore-current')) { control.ignoreCurrentElement(); } } diff --git a/modules/angular2/test/render/dom/events/event_manager_spec.ts b/modules/angular2/test/render/dom/events/event_manager_spec.ts index 8dc5bc969e..35a49f9889 100644 --- a/modules/angular2/test/render/dom/events/event_manager_spec.ts +++ b/modules/angular2/test/render/dom/events/event_manager_spec.ts @@ -52,9 +52,9 @@ export function main() { var manager = new EventManager([plugin1, plugin2], new FakeNgZone()); manager.addEventListener(element, 'click', clickHandler); manager.addEventListener(element, 'dblclick', dblClickHandler); - expect(MapWrapper.contains(plugin1._nonBubbleEventHandlers, 'click')).toBe(false); + expect(plugin1._nonBubbleEventHandlers.has('click')).toBe(false); expect(plugin2._nonBubbleEventHandlers.get('click')).toBe(clickHandler); - expect(MapWrapper.contains(plugin2._nonBubbleEventHandlers, 'dblclick')).toBe(false); + expect(plugin2._nonBubbleEventHandlers.has('dblclick')).toBe(false); expect(plugin1._nonBubbleEventHandlers.get('dblclick')).toBe(dblClickHandler); });