diff --git a/modules/@angular/compiler/src/directive_normalizer.ts b/modules/@angular/compiler/src/directive_normalizer.ts index 1c130fd28a..564f367da6 100644 --- a/modules/@angular/compiler/src/directive_normalizer.ts +++ b/modules/@angular/compiler/src/directive_normalizer.ts @@ -205,7 +205,7 @@ class TemplatePreparseVisitor implements HtmlAstVisitor { var textContent = ''; ast.children.forEach(child => { if (child instanceof HtmlTextAst) { - textContent += (child).value; + textContent += child.value; } }); this.styles.push(textContent); diff --git a/modules/@angular/compiler/src/directive_resolver.ts b/modules/@angular/compiler/src/directive_resolver.ts index 283d6ac5b4..2c18904041 100644 --- a/modules/@angular/compiler/src/directive_resolver.ts +++ b/modules/@angular/compiler/src/directive_resolver.ts @@ -62,30 +62,22 @@ export class DirectiveResolver { } else { inputs.push(propName); } - } - - if (a instanceof OutputMetadata) { + } else if (a instanceof OutputMetadata) { if (isPresent(a.bindingPropertyName)) { outputs.push(`${propName}: ${a.bindingPropertyName}`); } else { outputs.push(propName); } - } - - if (a instanceof HostBindingMetadata) { + } else if (a instanceof HostBindingMetadata) { if (isPresent(a.hostPropertyName)) { host[`[${a.hostPropertyName}]`] = propName; } else { host[`[${propName}]`] = propName; } - } - - if (a instanceof HostListenerMetadata) { + } else if (a instanceof HostListenerMetadata) { var args = isPresent(a.args) ? (a.args).join(', ') : ''; host[`(${a.eventName})`] = `${propName}(${args})`; - } - - if (a instanceof QueryMetadata) { + } else if (a instanceof QueryMetadata) { queries[propName] = a; } }); diff --git a/modules/@angular/compiler/src/output/output_interpreter.ts b/modules/@angular/compiler/src/output/output_interpreter.ts index bd08b79668..d9b35eecc9 100644 --- a/modules/@angular/compiler/src/output/output_interpreter.ts +++ b/modules/@angular/compiler/src/output/output_interpreter.ts @@ -63,7 +63,7 @@ function createDynamicClass( }; }); _classStmt.methods.forEach(function(method: o.ClassMethod) { - var paramNames = method.params.map(param => param.name); + const paramNames = method.params.map(param => param.name); // Note: use `function` instead of arrow function to capture `this` propertyDescriptors[method.name] = { writable: false, diff --git a/modules/@angular/compiler/src/provider_parser.ts b/modules/@angular/compiler/src/provider_parser.ts index ceaaf1315d..4f45d10071 100644 --- a/modules/@angular/compiler/src/provider_parser.ts +++ b/modules/@angular/compiler/src/provider_parser.ts @@ -72,7 +72,7 @@ export class ProviderElementContext { // create the providers that we know are eager first this._allProviders.values().forEach((provider) => { - var eager = provider.eager || isPresent(queriedTokens.get(provider.token)); + const eager = provider.eager || isPresent(queriedTokens.get(provider.token)); if (eager) { this._getOrCreateLocalProvider(provider.providerType, provider.token, true); } @@ -102,7 +102,7 @@ export class ProviderElementContext { private _addQueryReadsTo(token: CompileTokenMetadata, queryReadTokens: CompileTokenMap) { this._getQueriesFor(token).forEach((query) => { - var queryReadToken = isPresent(query.read) ? query.read : token; + const queryReadToken = isPresent(query.read) ? query.read : token; if (isBlank(queryReadTokens.get(queryReadToken))) { queryReadTokens.add(queryReadToken, true); } @@ -282,7 +282,7 @@ export class AppModuleProviderParser { constructor(appModule: CompileAppModuleMetadata, sourceSpan: ParseSourceSpan) { this._allProviders = new CompileTokenMap(); [appModule.type].concat(appModule.modules).forEach((appModuleType: CompileTypeMetadata) => { - var appModuleProvider = new CompileProviderMetadata( + const appModuleProvider = new CompileProviderMetadata( {token: new CompileTokenMetadata({identifier: appModuleType}), useClass: appModuleType}); _resolveProviders( [appModuleProvider], ProviderAstType.PublicService, true, sourceSpan, this._errors, @@ -297,7 +297,7 @@ export class AppModuleProviderParser { this._allProviders.values().forEach( (provider) => { this._getOrCreateLocalProvider(provider.token, provider.eager); }); if (this._errors.length > 0) { - var errorString = this._errors.join('\n'); + const errorString = this._errors.join('\n'); throw new BaseException(`Provider parse errors:\n${errorString}`); } return this._transformedProviders.values(); @@ -415,7 +415,7 @@ function _normalizeProviders( if (isArray(provider)) { _normalizeProviders(provider, sourceSpan, targetErrors, targetProviders); } else { - var normalizeProvider: CompileProviderMetadata; + let normalizeProvider: CompileProviderMetadata; if (provider instanceof CompileProviderMetadata) { normalizeProvider = provider; } else if (provider instanceof CompileTypeMetadata) { diff --git a/modules/@angular/compiler/src/runtime_compiler.ts b/modules/@angular/compiler/src/runtime_compiler.ts index abd7182daf..26a59646f7 100644 --- a/modules/@angular/compiler/src/runtime_compiler.ts +++ b/modules/@angular/compiler/src/runtime_compiler.ts @@ -163,7 +163,8 @@ export class RuntimeCompiler implements ComponentResolver, Compiler { } } }); - let compile = () => { templates.forEach((template) => { this._compileTemplate(template); }); }; + const compile = + () => { templates.forEach((template) => { this._compileTemplate(template); }); }; if (isSync) { compile(); } @@ -212,12 +213,12 @@ export class RuntimeCompiler implements ComponentResolver, Compiler { modulePipes: ConcreteType[]): CompiledTemplate { var compiledTemplate = this._compiledTemplateCache.get(type); if (isBlank(compiledTemplate)) { - var compMeta = this._metadataResolver.getDirectiveMetadata(type); + const compMeta = this._metadataResolver.getDirectiveMetadata(type); assertComponent(compMeta); - var viewDirectives: CompileDirectiveMetadata[] = []; + const viewDirectives: CompileDirectiveMetadata[] = []; moduleDirectives.forEach( (type) => viewDirectives.push(this._metadataResolver.getDirectiveMetadata(type))); - var viewComponentTypes: Type[] = []; + const viewComponentTypes: Type[] = []; this._metadataResolver.getViewDirectivesMetadata(type).forEach(dirOrComp => { if (dirOrComp.isComponent) { viewComponentTypes.push(dirOrComp.type.runtime); @@ -225,8 +226,8 @@ export class RuntimeCompiler implements ComponentResolver, Compiler { viewDirectives.push(dirOrComp); } }); - var precompileComponentTypes = compMeta.precompile.map((typeMeta) => typeMeta.runtime); - var pipes = [ + const precompileComponentTypes = compMeta.precompile.map((typeMeta) => typeMeta.runtime); + const pipes = [ ...modulePipes.map((type) => this._metadataResolver.getPipeMetadata(type)), ...this._metadataResolver.getViewPipesMetadata(type) ]; @@ -242,8 +243,8 @@ export class RuntimeCompiler implements ComponentResolver, Compiler { compType: Type, isHost: boolean, moduleDirectives: ConcreteType[], modulePipes: ConcreteType[], target: Set = new Set()): Set { - var template = isHost ? this._createCompiledHostTemplate(compType) : - this._createCompiledTemplate(compType, moduleDirectives, modulePipes); + const template = isHost ? this._createCompiledHostTemplate(compType) : + this._createCompiledTemplate(compType, moduleDirectives, modulePipes); if (!target.has(template)) { target.add(template); template.viewComponentTypes.forEach((compType) => { @@ -261,22 +262,22 @@ export class RuntimeCompiler implements ComponentResolver, Compiler { if (template.isCompiled) { return; } - var compMeta = template.normalizedCompMeta; - var externalStylesheetsByModuleUrl = new Map(); - var stylesCompileResult = this._styleCompiler.compileComponent(compMeta); + const compMeta = template.normalizedCompMeta; + const externalStylesheetsByModuleUrl = new Map(); + const stylesCompileResult = this._styleCompiler.compileComponent(compMeta); stylesCompileResult.externalStylesheets.forEach( (r) => { externalStylesheetsByModuleUrl.set(r.meta.moduleUrl, r); }); this._resolveStylesCompileResult( stylesCompileResult.componentStylesheet, externalStylesheetsByModuleUrl); - var viewCompMetas = template.viewComponentTypes.map( + const viewCompMetas = template.viewComponentTypes.map( (compType) => this._compiledTemplateCache.get(compType).normalizedCompMeta); - var parsedTemplate = this._templateParser.parse( + const parsedTemplate = this._templateParser.parse( compMeta, compMeta.template.template, template.viewDirectives.concat(viewCompMetas), template.viewPipes, compMeta.type.name); - var compileResult = this._viewCompiler.compileComponent( + const compileResult = this._viewCompiler.compileComponent( compMeta, parsedTemplate, ir.variable(stylesCompileResult.componentStylesheet.stylesVar), template.viewPipes); - var depTemplates = compileResult.dependencies.map((dep) => { + compileResult.dependencies.forEach((dep) => { let depTemplate: CompiledTemplate; if (dep instanceof ViewFactoryDependency) { let vfd = dep; @@ -289,11 +290,10 @@ export class RuntimeCompiler implements ComponentResolver, Compiler { cfd.placeholder.runtime = depTemplate.proxyComponentFactory; cfd.placeholder.name = `compFactory_${cfd.comp.name}`; } - return depTemplate; }); - var statements = + const statements = stylesCompileResult.componentStylesheet.statements.concat(compileResult.statements); - var factory: any; + let factory: any; if (IS_DART || !this._genConfig.useJit) { factory = interpretStatements(statements, compileResult.viewFactoryVar); } else { diff --git a/modules/@angular/compiler/src/selector.ts b/modules/@angular/compiler/src/selector.ts index 347f6d02b3..e2c9562b3f 100644 --- a/modules/@angular/compiler/src/selector.ts +++ b/modules/@angular/compiler/src/selector.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {ListWrapper, Map} from '../src/facade/collection'; +import {ListWrapper} from '../src/facade/collection'; import {BaseException} from '../src/facade/exceptions'; import {RegExpMatcherWrapper, RegExpWrapper, StringWrapper, isBlank, isPresent} from '../src/facade/lang'; diff --git a/modules/@angular/compiler/src/shadow_css.ts b/modules/@angular/compiler/src/shadow_css.ts index e3f5c8f263..bfb940557e 100644 --- a/modules/@angular/compiler/src/shadow_css.ts +++ b/modules/@angular/compiler/src/shadow_css.ts @@ -7,7 +7,7 @@ */ import {ListWrapper} from '../src/facade/collection'; -import {RegExp, RegExpMatcherWrapper, RegExpWrapper, StringWrapper, isBlank, isPresent} from '../src/facade/lang'; +import {RegExpMatcherWrapper, RegExpWrapper, StringWrapper, isBlank, isPresent} from '../src/facade/lang'; /** * This file is a port of shadowCSS from webcomponents.js to TypeScript. diff --git a/modules/@angular/compiler/src/style_compiler.ts b/modules/@angular/compiler/src/style_compiler.ts index db17e4a15d..3f5d56c8e7 100644 --- a/modules/@angular/compiler/src/style_compiler.ts +++ b/modules/@angular/compiler/src/style_compiler.ts @@ -13,8 +13,8 @@ import {ShadowCss} from './shadow_css'; import {UrlResolver} from './url_resolver'; const COMPONENT_VARIABLE = '%COMP%'; -const HOST_ATTR = /*@ts2dart_const*/ `_nghost-${COMPONENT_VARIABLE}`; -const CONTENT_ATTR = /*@ts2dart_const*/ `_ngcontent-${COMPONENT_VARIABLE}`; +const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`; +const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`; export class StylesCompileDependency { constructor( diff --git a/modules/@angular/compiler/src/template_ast.ts b/modules/@angular/compiler/src/template_ast.ts index ab02652fbf..2962bcc09a 100644 --- a/modules/@angular/compiler/src/template_ast.ts +++ b/modules/@angular/compiler/src/template_ast.ts @@ -7,9 +7,7 @@ */ import {isPresent} from '../src/facade/lang'; - import {AST} from './expression_parser/ast'; - import {CompileDirectiveMetadata, CompileTokenMetadata, CompileProviderMetadata,} from './compile_metadata'; import {ParseSourceSpan} from './parse_util'; import {SecurityContext} from '@angular/core'; diff --git a/modules/@angular/core/src/linker/app_module_factory.ts b/modules/@angular/core/src/linker/app_module_factory.ts index bc66577875..9d933163a4 100644 --- a/modules/@angular/core/src/linker/app_module_factory.ts +++ b/modules/@angular/core/src/linker/app_module_factory.ts @@ -9,7 +9,6 @@ import {Injector, THROW_IF_NOT_FOUND} from '../di/injector'; import {unimplemented} from '../facade/exceptions'; import {ConcreteType} from '../facade/lang'; - import {ComponentFactory} from './component_factory'; import {CodegenComponentFactoryResolver, ComponentFactoryResolver} from './component_factory_resolver'; diff --git a/modules/@angular/core/src/linker/component_factory.ts b/modules/@angular/core/src/linker/component_factory.ts index 83841df95d..fc7647151d 100644 --- a/modules/@angular/core/src/linker/component_factory.ts +++ b/modules/@angular/core/src/linker/component_factory.ts @@ -9,11 +9,10 @@ import {ChangeDetectorRef} from '../change_detection/change_detection'; import {Injector} from '../di/injector'; import {unimplemented} from '../facade/exceptions'; -import {Type, isBlank, isPresent} from '../facade/lang'; - +import {Type, isBlank} from '../facade/lang'; import {AppElement} from './element'; import {ElementRef} from './element_ref'; -import {ViewRef, ViewRef_} from './view_ref'; +import {ViewRef} from './view_ref'; import {ViewUtils} from './view_utils'; @@ -80,12 +79,11 @@ export class ComponentRef_ extends ComponentRef { onDestroy(callback: Function): void { this.hostView.onDestroy(callback); } } - /** * @experimental * @ts2dart_const */ -const EMPTY_CONTEXT = /*@ts2dart_const*/ new Object(); +const EMPTY_CONTEXT = new Object(); /** * @stable diff --git a/modules/@angular/core/src/linker/component_factory_resolver.ts b/modules/@angular/core/src/linker/component_factory_resolver.ts index 5c27dd0079..63913bbc0c 100644 --- a/modules/@angular/core/src/linker/component_factory_resolver.ts +++ b/modules/@angular/core/src/linker/component_factory_resolver.ts @@ -6,13 +6,10 @@ * found in the LICENSE file at https://angular.io/license */ -import {Inject, OpaqueToken, Optional, SkipSelf} from '../di'; import {BaseException} from '../facade/exceptions'; import {ConcreteType, stringify} from '../facade/lang'; - import {ComponentFactory} from './component_factory'; - /** * @stable */ diff --git a/modules/@angular/core/src/linker/component_resolver.ts b/modules/@angular/core/src/linker/component_resolver.ts index 2e44565fb6..910efa46bf 100644 --- a/modules/@angular/core/src/linker/component_resolver.ts +++ b/modules/@angular/core/src/linker/component_resolver.ts @@ -12,10 +12,8 @@ import {PromiseWrapper} from '../facade/async'; import {BaseException} from '../facade/exceptions'; import {Type, isBlank, isString, stringify} from '../facade/lang'; import {reflector} from '../reflection/reflection'; - import {ComponentFactory} from './component_factory'; - /** * Low-level service for loading {@link ComponentFactory}s, which * can later be used to create and render a Component instance. diff --git a/modules/@angular/core/src/linker/debug_context.ts b/modules/@angular/core/src/linker/debug_context.ts index ce2eec9c98..ee229c9a6e 100644 --- a/modules/@angular/core/src/linker/debug_context.ts +++ b/modules/@angular/core/src/linker/debug_context.ts @@ -7,7 +7,7 @@ */ import {Injector} from '../di'; -import {ListWrapper, StringMapWrapper} from '../facade/collection'; +import {StringMapWrapper} from '../facade/collection'; import {isBlank, isPresent} from '../facade/lang'; import {RenderDebugInfo} from '../render/api'; @@ -51,7 +51,7 @@ export class DebugContext implements RenderDebugInfo { } get injector(): Injector { return this._view.injector(this._nodeIndex); } get renderNode(): any { - if (isPresent(this._nodeIndex) && isPresent(this._view.allNodes)) { + if (isPresent(this._nodeIndex) && this._view.allNodes) { return this._view.allNodes[this._nodeIndex]; } else { return null; @@ -69,17 +69,15 @@ export class DebugContext implements RenderDebugInfo { var staticNodeInfo = this._staticNodeInfo; if (isPresent(staticNodeInfo)) { var refs = staticNodeInfo.refTokens; - StringMapWrapper.forEach( - refs, (refToken: any /** TODO #9100 */, refName: any /** TODO #9100 */) => { - var varValue: any /** TODO #9100 */; - if (isBlank(refToken)) { - varValue = - isPresent(this._view.allNodes) ? this._view.allNodes[this._nodeIndex] : null; - } else { - varValue = this._view.injectorGet(refToken, this._nodeIndex, null); - } - varValues[refName] = varValue; - }); + StringMapWrapper.forEach(refs, (refToken: any, refName: string) => { + let varValue: any; + if (isBlank(refToken)) { + varValue = this._view.allNodes ? this._view.allNodes[this._nodeIndex] : null; + } else { + varValue = this._view.injectorGet(refToken, this._nodeIndex, null); + } + varValues[refName] = varValue; + }); } return varValues; } diff --git a/modules/@angular/core/src/linker/dynamic_component_loader.ts b/modules/@angular/core/src/linker/dynamic_component_loader.ts index 2ef6030ed8..7b58353461 100644 --- a/modules/@angular/core/src/linker/dynamic_component_loader.ts +++ b/modules/@angular/core/src/linker/dynamic_component_loader.ts @@ -6,12 +6,8 @@ * found in the LICENSE file at https://angular.io/license */ -import {Injectable} from '../di/decorators'; -import {Injector} from '../di/injector'; -import {ReflectiveInjector} from '../di/reflective_injector'; -import {ResolvedReflectiveProvider} from '../di/reflective_provider'; +import {Injectable, Injector, ReflectiveInjector, ResolvedReflectiveProvider} from '../di'; import {Type, isPresent} from '../facade/lang'; - import {ComponentRef} from './component_factory'; import {ComponentResolver} from './component_resolver'; import {ViewContainerRef} from './view_container_ref'; diff --git a/modules/@angular/core/src/linker/template_ref.ts b/modules/@angular/core/src/linker/template_ref.ts index 7c461c6702..f93bb07189 100644 --- a/modules/@angular/core/src/linker/template_ref.ts +++ b/modules/@angular/core/src/linker/template_ref.ts @@ -7,7 +7,6 @@ */ import {isBlank} from '../facade/lang'; - import {AppElement} from './element'; import {ElementRef} from './element_ref'; import {AppView} from './view'; diff --git a/modules/@angular/core/src/linker/view.ts b/modules/@angular/core/src/linker/view.ts index d7ca8f0f76..2a3a3b2993 100644 --- a/modules/@angular/core/src/linker/view.ts +++ b/modules/@angular/core/src/linker/view.ts @@ -7,27 +7,21 @@ */ import {ObservableWrapper} from '../facade/async'; -import {ListWrapper, Map, MapWrapper, StringMapWrapper} from '../facade/collection'; -import {Type, isArray, isBlank, isNumber, isPresent, isPrimitive, isString, stringify} from '../facade/lang'; -import {RenderComponentType, RenderDebugInfo, Renderer, RootRenderer} from '../render/api'; - +import {ListWrapper} from '../facade/collection'; +import {isPresent} from '../facade/lang'; +import {RenderComponentType, RenderDebugInfo, Renderer} from '../render/api'; import {AppElement} from './element'; import {ViewRef_} from './view_ref'; import {ViewType} from './view_type'; -import {ViewUtils, arrayLooseIdentical, ensureSlotCount, flattenNestedViewRenderNodes, mapLooseIdentical} from './view_utils'; - -import {ChangeDetectorRef, ChangeDetectionStrategy, ChangeDetectorStatus,} from '../change_detection/change_detection'; +import {ViewUtils, ensureSlotCount, flattenNestedViewRenderNodes} from './view_utils'; +import {ChangeDetectorRef, ChangeDetectorStatus,} from '../change_detection/change_detection'; import {wtfCreateScope, wtfLeave, WtfScopeFn} from '../profile/profile'; import {ExpressionChangedAfterItHasBeenCheckedException, ViewDestroyedException, ViewWrappedException} from './exceptions'; import {StaticNodeDebugInfo, DebugContext} from './debug_context'; import {ElementInjector} from './element_injector'; import {Injector} from '../di/injector'; - -import {AUTO_STYLE} from '../animation/metadata'; import {AnimationPlayer} from '../animation/animation_player'; import {AnimationGroupPlayer} from '../animation/animation_group_player'; -import {AnimationKeyframe} from '../animation/animation_keyframe'; -import {AnimationStyles} from '../animation/animation_styles'; import {ViewAnimationMap} from '../animation/view_animation_map'; var _scope_check: WtfScopeFn = wtfCreateScope(`AppView#check(ascii id)`); @@ -99,7 +93,7 @@ export abstract class AppView { create(context: T, givenProjectableNodes: Array, rootSelectorOrNode: string|any): AppElement { this.context = context; - var projectableNodes: any /** TODO #9100 */; + var projectableNodes: any[]; switch (this.type) { case ViewType.COMPONENT: projectableNodes = ensureSlotCount(givenProjectableNodes, this.componentType.slotCount); @@ -141,7 +135,7 @@ export abstract class AppView { selectOrCreateHostElement( elementName: string, rootSelectorOrNode: string|any, debugInfo: RenderDebugInfo): any { - var hostElement: any /** TODO #9100 */; + var hostElement: any; if (isPresent(rootSelectorOrNode)) { hostElement = this.renderer.selectRootElement(rootSelectorOrNode, debugInfo); } else { @@ -405,7 +399,7 @@ export class DebugAppView extends AppView { eventHandler(cb: Function): Function { var superHandler = super.eventHandler(cb); - return (event: any /** TODO #9100 */) => { + return (event: any) => { this._resetDebug(); try { return superHandler(event); @@ -418,7 +412,7 @@ export class DebugAppView extends AppView { } function _findLastRenderNode(node: any): any { - var lastNode: any /** TODO #9100 */; + var lastNode: any; if (node instanceof AppElement) { var appEl = node; lastNode = appEl.nativeElement; diff --git a/modules/@angular/core/src/linker/view_container_ref.ts b/modules/@angular/core/src/linker/view_container_ref.ts index 828432fddf..c2135e3ebd 100644 --- a/modules/@angular/core/src/linker/view_container_ref.ts +++ b/modules/@angular/core/src/linker/view_container_ref.ts @@ -11,7 +11,6 @@ import {ListWrapper} from '../facade/collection'; import {unimplemented} from '../facade/exceptions'; import {isPresent} from '../facade/lang'; import {WtfScopeFn, wtfCreateScope, wtfLeave} from '../profile/profile'; - import {ComponentFactory, ComponentRef} from './component_factory'; import {AppElement} from './element'; import {ElementRef} from './element_ref'; diff --git a/modules/@angular/core/src/linker/view_ref.ts b/modules/@angular/core/src/linker/view_ref.ts index b27a808156..1f0eacd908 100644 --- a/modules/@angular/core/src/linker/view_ref.ts +++ b/modules/@angular/core/src/linker/view_ref.ts @@ -7,12 +7,10 @@ */ import {ChangeDetectorRef} from '../change_detection/change_detector_ref'; -import {ChangeDetectionStrategy, ChangeDetectorStatus} from '../change_detection/constants'; +import {ChangeDetectorStatus} from '../change_detection/constants'; import {unimplemented} from '../facade/exceptions'; - import {AppView} from './view'; - /** * @stable */ @@ -84,7 +82,7 @@ export abstract class EmbeddedViewRef extends ViewRef { /** * Destroys the view and all of the data structures associated with it. */ - abstract destroy(): any /** TODO #9100 */; + abstract destroy(): void; } export class ViewRef_ implements EmbeddedViewRef, ChangeDetectorRef { diff --git a/modules/@angular/core/src/linker/view_utils.ts b/modules/@angular/core/src/linker/view_utils.ts index c198695ac4..f7bbd07a35 100644 --- a/modules/@angular/core/src/linker/view_utils.ts +++ b/modules/@angular/core/src/linker/view_utils.ts @@ -10,13 +10,12 @@ import {APP_ID} from '../application_tokens'; import {devModeEqual} from '../change_detection/change_detection'; import {UNINITIALIZED} from '../change_detection/change_detection_util'; import {Inject, Injectable} from '../di/decorators'; -import {ListWrapper, StringMapWrapper} from '../facade/collection'; +import {ListWrapper} from '../facade/collection'; import {BaseException} from '../facade/exceptions'; import {isBlank, isPresent, looseIdentical} from '../facade/lang'; import {ViewEncapsulation} from '../metadata/view'; import {RenderComponentType, Renderer, RootRenderer} from '../render/api'; import {SanitizationService} from '../security'; - import {AppElement} from './element'; import {ExpressionChangedAfterItHasBeenCheckedException} from './exceptions'; @@ -71,10 +70,10 @@ function _flattenNestedViewRenderNodes(nodes: any[], renderNodes: any[]): any[] return renderNodes; } -const EMPTY_ARR: any[] /** TODO #9100 */ = /*@ts2dart_const*/[]; +const EMPTY_ARR: any[] = /*@ts2dart_const*/[]; export function ensureSlotCount(projectableNodes: any[][], expectedSlotCount: number): any[][] { - var res: any /** TODO #9100 */; + var res: any[][]; if (isBlank(projectableNodes)) { res = EMPTY_ARR; } else if (projectableNodes.length < expectedSlotCount) { @@ -144,41 +143,17 @@ export function checkBinding(throwOnChange: boolean, oldValue: any, newValue: an } } -export function arrayLooseIdentical(a: any[], b: any[]): boolean { - if (a.length != b.length) return false; - for (var i = 0; i < a.length; ++i) { - if (!looseIdentical(a[i], b[i])) return false; - } - return true; -} - -export function mapLooseIdentical(m1: {[key: string]: V}, m2: {[key: string]: V}): boolean { - var k1 = StringMapWrapper.keys(m1); - var k2 = StringMapWrapper.keys(m2); - if (k1.length != k2.length) { - return false; - } - var key: any /** TODO #9100 */; - for (var i = 0; i < k1.length; i++) { - key = k1[i]; - if (!looseIdentical(m1[key], m2[key])) { - return false; - } - } - return true; -} - export function castByValue(input: any, value: T): T { return input; } -export const EMPTY_ARRAY: any[] /** TODO #9100 */ = /*@ts2dart_const*/[]; -export const EMPTY_MAP = /*@ts2dart_const*/ {}; +export const EMPTY_ARRAY: any[] = []; +export const EMPTY_MAP = {}; export function pureProxy1(fn: (p0: P0) => R): (p0: P0) => R { - var result: R; - var v0: any /** TODO #9100 */; - v0 = UNINITIALIZED; + let result: R; + let v0: any = UNINITIALIZED; + return (p0) => { if (!looseIdentical(v0, p0)) { v0 = p0; @@ -189,9 +164,10 @@ export function pureProxy1(fn: (p0: P0) => R): (p0: P0) => R { } export function pureProxy2(fn: (p0: P0, p1: P1) => R): (p0: P0, p1: P1) => R { - var result: R; - var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */; - v0 = v1 = UNINITIALIZED; + let result: R; + let v0: any = UNINITIALIZED; + let v1: any = UNINITIALIZED; + return (p0, p1) => { if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1)) { v0 = p0; @@ -204,9 +180,11 @@ export function pureProxy2(fn: (p0: P0, p1: P1) => R): (p0: P0, p1: P export function pureProxy3(fn: (p0: P0, p1: P1, p2: P2) => R): ( p0: P0, p1: P1, p2: P2) => R { - var result: R; - var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */; - v0 = v1 = v2 = UNINITIALIZED; + let result: R; + let v0: any = UNINITIALIZED; + let v1: any = UNINITIALIZED; + let v2: any = UNINITIALIZED; + return (p0, p1, p2) => { if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2)) { v0 = p0; @@ -220,9 +198,8 @@ export function pureProxy3(fn: (p0: P0, p1: P1, p2: P2) => R): ( export function pureProxy4(fn: (p0: P0, p1: P1, p2: P2, p3: P3) => R): ( p0: P0, p1: P1, p2: P2, p3: P3) => R { - var result: R; - var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, - v3: any /** TODO #9100 */; + let result: R; + let v0: any, v1: any, v2: any, v3: any; v0 = v1 = v2 = v3 = UNINITIALIZED; return (p0, p1, p2, p3) => { if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) || @@ -240,9 +217,8 @@ export function pureProxy4(fn: (p0: P0, p1: P1, p2: P2, p3: P export function pureProxy5( fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4) => R { - var result: R; - var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, - v3: any /** TODO #9100 */, v4: any /** TODO #9100 */; + let result: R; + let v0: any, v1: any, v2: any, v3: any, v4: any; v0 = v1 = v2 = v3 = v4 = UNINITIALIZED; return (p0, p1, p2, p3, p4) => { if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) || @@ -262,9 +238,8 @@ export function pureProxy5( export function pureProxy6( fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5) => R { - var result: R; - var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, - v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */; + let result: R; + let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any; v0 = v1 = v2 = v3 = v4 = v5 = UNINITIALIZED; return (p0, p1, p2, p3, p4, p5) => { if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) || @@ -284,10 +259,8 @@ export function pureProxy6( export function pureProxy7( fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6) => R { - var result: R; - var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, - v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */, - v6: any /** TODO #9100 */; + let result: R; + let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any; v0 = v1 = v2 = v3 = v4 = v5 = v6 = UNINITIALIZED; return (p0, p1, p2, p3, p4, p5, p6) => { if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) || @@ -309,10 +282,8 @@ export function pureProxy7( export function pureProxy8( fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7) => R { - var result: R; - var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, - v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */, - v6: any /** TODO #9100 */, v7: any /** TODO #9100 */; + let result: R; + let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any; v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = UNINITIALIZED; return (p0, p1, p2, p3, p4, p5, p6, p7) => { if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) || @@ -335,10 +306,8 @@ export function pureProxy8( export function pureProxy9( fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8) => R { - var result: R; - var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, - v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */, - v6: any /** TODO #9100 */, v7: any /** TODO #9100 */, v8: any /** TODO #9100 */; + let result: R; + let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any, v8: any; v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = UNINITIALIZED; return (p0, p1, p2, p3, p4, p5, p6, p7, p8) => { if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) || @@ -362,11 +331,8 @@ export function pureProxy9( export function pureProxy10( fn: (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9) => R): (p0: P0, p1: P1, p2: P2, p3: P3, p4: P4, p5: P5, p6: P6, p7: P7, p8: P8, p9: P9) => R { - var result: R; - var v0: any /** TODO #9100 */, v1: any /** TODO #9100 */, v2: any /** TODO #9100 */, - v3: any /** TODO #9100 */, v4: any /** TODO #9100 */, v5: any /** TODO #9100 */, - v6: any /** TODO #9100 */, v7: any /** TODO #9100 */, v8: any /** TODO #9100 */, - v9: any /** TODO #9100 */; + let result: R; + let v0: any, v1: any, v2: any, v3: any, v4: any, v5: any, v6: any, v7: any, v8: any, v9: any; v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = v9 = UNINITIALIZED; return (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) => { if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) || diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index 926270a5ac..2e9e566ea4 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -705,7 +705,7 @@ export declare class ElementRef { export declare abstract class EmbeddedViewRef extends ViewRef { context: C; rootNodes: any[]; - abstract destroy(): any; + abstract destroy(): void; } /** @experimental */