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
This commit is contained in:
Tobias Bosch 2016-06-29 10:26:45 -07:00
parent e81dea695c
commit 51d4c9dcbd
3 changed files with 15 additions and 10 deletions

View File

@ -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 {

View File

@ -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 = <ViewFactoryDependency>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 = <ComponentFactoryDependency>dep;
cfd.placeholder.name = _componentFactoryName(cfd.comp);
cfd.placeholder.moduleUrl = _ngfactoryModuleUrl(cfd.comp);
}
});
return compileResult.statements;

View File

@ -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 = <ViewFactoryDependency>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 = <ComponentFactoryDependency>dep;
depTemplate = this._getCompiledHostTemplate(cfd.comp.runtime);
cfd.placeholder.runtime = depTemplate.proxyComponentFactory;
cfd.placeholder.name = `compFactory_${cfd.comp.name}`;
}
return depTemplate;
});