fix(compiler): fix transpiled ES5 code (#13322)

fixes #13301

The inner class would transpile to a nested function declaration which is not
allowed in ES5.

See http://eslint.org/docs/rules/no-inner-declarations
This commit is contained in:
Victor Berchet 2016-12-08 15:02:59 -08:00 committed by GitHub
parent 1b547886d0
commit 4398056146
1 changed files with 4 additions and 4 deletions

View File

@ -213,11 +213,11 @@ export class JitCompiler implements Compiler {
const compMeta = this._metadataResolver.getDirectiveMetadata(compType); const compMeta = this._metadataResolver.getDirectiveMetadata(compType);
assertComponent(compMeta); assertComponent(compMeta);
class HostClass { const hostClass = {
static overriddenName = `${identifierName(compMeta.type)}_Host`; overriddenName: `${identifierName(compMeta.type)}_Host`,
} };
const hostMeta = createHostComponentMeta(HostClass, compMeta); const hostMeta = createHostComponentMeta(hostClass, compMeta);
compiledTemplate = new CompiledTemplate( compiledTemplate = new CompiledTemplate(
true, compMeta.selector, compMeta.type, hostMeta, ngModule, [compMeta.type]); true, compMeta.selector, compMeta.type, hostMeta, ngModule, [compMeta.type]);
this._compiledHostTemplateCache.set(compType, compiledTemplate); this._compiledHostTemplateCache.set(compType, compiledTemplate);