From 51d4c9dcbd03bb18f6dd81c6f503392a0477786e Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Wed, 29 Jun 2016 10:26:45 -0700 Subject: [PATCH] fix(compiler): make code easier to type check These changes are needed for the G3 sync as we use a different version/settings of Typescript than on Github. closes #9701 --- .../@angular/compiler/src/directive_normalizer.ts | 3 ++- modules/@angular/compiler/src/offline_compiler.ts | 8 +++++--- modules/@angular/compiler/src/runtime_compiler.ts | 14 ++++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/@angular/compiler/src/directive_normalizer.ts b/modules/@angular/compiler/src/directive_normalizer.ts index 75dee4d97f..e08f09c0e3 100644 --- a/modules/@angular/compiler/src/directive_normalizer.ts +++ b/modules/@angular/compiler/src/directive_normalizer.ts @@ -9,6 +9,7 @@ import {Injectable, ViewEncapsulation} from '@angular/core'; import {PromiseWrapper} from '../src/facade/async'; +import {MapWrapper} from '../src/facade/collection'; import {BaseException} from '../src/facade/exceptions'; import {isBlank, isPresent} from '../src/facade/lang'; @@ -173,7 +174,7 @@ export class DirectiveNormalizer { return this._loadMissingExternalStylesheets( stylesheet.styleUrls, loadedStylesheets); }))) - .then((_) => Array.from(loadedStylesheets.values())); + .then((_) => MapWrapper.values(loadedStylesheets)); } normalizeStylesheet(stylesheet: CompileStylesheetMetadata): CompileStylesheetMetadata { diff --git a/modules/@angular/compiler/src/offline_compiler.ts b/modules/@angular/compiler/src/offline_compiler.ts index 1d6b2ae774..43b82328cf 100644 --- a/modules/@angular/compiler/src/offline_compiler.ts +++ b/modules/@angular/compiler/src/offline_compiler.ts @@ -129,10 +129,12 @@ export class OfflineCompiler { function _resolveViewStatements(compileResult: ViewCompileResult): o.Statement[] { compileResult.dependencies.forEach((dep) => { if (dep instanceof ViewFactoryDependency) { - dep.placeholder.moduleUrl = _ngfactoryModuleUrl(dep.comp); + let vfd = dep; + vfd.placeholder.moduleUrl = _ngfactoryModuleUrl(vfd.comp); } else if (dep instanceof ComponentFactoryDependency) { - dep.placeholder.name = _componentFactoryName(dep.comp); - dep.placeholder.moduleUrl = _ngfactoryModuleUrl(dep.comp); + let cfd = dep; + cfd.placeholder.name = _componentFactoryName(cfd.comp); + cfd.placeholder.moduleUrl = _ngfactoryModuleUrl(cfd.comp); } }); return compileResult.statements; diff --git a/modules/@angular/compiler/src/runtime_compiler.ts b/modules/@angular/compiler/src/runtime_compiler.ts index e3fe012461..915dac0d3d 100644 --- a/modules/@angular/compiler/src/runtime_compiler.ts +++ b/modules/@angular/compiler/src/runtime_compiler.ts @@ -172,13 +172,15 @@ export class RuntimeCompiler implements ComponentResolver, Compiler { var depTemplates = compileResult.dependencies.map((dep) => { let depTemplate: CompiledTemplate; if (dep instanceof ViewFactoryDependency) { - depTemplate = this._getCompiledTemplate(dep.comp.runtime); - dep.placeholder.runtime = depTemplate.proxyViewFactory; - dep.placeholder.name = `viewFactory_${dep.comp.name}`; + let vfd = dep; + depTemplate = this._getCompiledTemplate(vfd.comp.runtime); + vfd.placeholder.runtime = depTemplate.proxyViewFactory; + vfd.placeholder.name = `viewFactory_${vfd.comp.name}`; } else if (dep instanceof ComponentFactoryDependency) { - depTemplate = this._getCompiledHostTemplate(dep.comp.runtime); - dep.placeholder.runtime = depTemplate.proxyComponentFactory; - dep.placeholder.name = `compFactory_${dep.comp.name}`; + let cfd = dep; + depTemplate = this._getCompiledHostTemplate(cfd.comp.runtime); + cfd.placeholder.runtime = depTemplate.proxyComponentFactory; + cfd.placeholder.name = `compFactory_${cfd.comp.name}`; } return depTemplate; });