Skip to content

Commit

Permalink
fix(compiler): fix performance regression caused by 5b0f9e2
Browse files Browse the repository at this point in the history
Fixes #13146
  • Loading branch information
chuckjaz authored and alxhub committed Nov 30, 2016
1 parent ba8645c commit ee2d6e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modules/@angular/compiler/src/metadata_resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class CompileMetadataResolver {
return null;
}

private _loadDirectiveMetadata(directiveType: any, isSync: boolean): Promise<any> {
private _loadDirectiveMetadata(directiveType: any, isSync: boolean): () => Promise<any> {
if (this._directiveCache.has(directiveType)) {
return;
}
Expand Down Expand Up @@ -191,7 +191,7 @@ export class CompileMetadataResolver {
if (isSync) {
throw new ComponentStillLoadingError(directiveType);
}
return templateMeta.asyncResult.then(createDirectiveMetadata);
return () => templateMeta.asyncResult.then(createDirectiveMetadata);
}
} else {
// directive
Expand Down Expand Up @@ -441,8 +441,10 @@ export class CompileMetadataResolver {
transitiveModule.directives.push(declaredIdentifier);
declaredDirectives.push(declaredIdentifier);
this._addTypeToModule(declaredType, moduleType);
transitiveModule.directiveLoaders.push(
() => this._loadDirectiveMetadata(declaredType, isSync));
const loader = this._loadDirectiveMetadata(declaredType, isSync);
if (loader) {
transitiveModule.directiveLoaders.push(loader);
}
} else if (this._pipeResolver.isPipe(declaredType)) {
transitiveModule.pipesSet.add(declaredType);
transitiveModule.pipes.push(declaredIdentifier);
Expand Down

0 comments on commit ee2d6e5

Please sign in to comment.