feat(compiler): mark @NgModules in provider lists for identification at runtime (#22005)

All of the providers in a module get compiled into a module definition in the
factory file. Some of these providers are for the actual module types, as those
are available for injection in Angular. For tree-shakeable tokens, the runtime
needs to be able to distinguish which modules are present in an injector.

This change adds a NodeFlag which tags those module providers for later
identification.

PR Close #22005
This commit is contained in:
Alex Rickabaugh
2018-02-02 09:31:58 -08:00
committed by Miško Hevery
parent 647b8595d0
commit 2d5e7d1b52
7 changed files with 28 additions and 10 deletions

View File

@ -192,7 +192,8 @@ export class ProviderAst implements TemplateAst {
constructor(
public token: CompileTokenMetadata, public multiProvider: boolean, public eager: boolean,
public providers: CompileProviderMetadata[], public providerType: ProviderAstType,
public lifecycleHooks: LifecycleHooks[], public sourceSpan: ParseSourceSpan) {}
public lifecycleHooks: LifecycleHooks[], public sourceSpan: ParseSourceSpan,
readonly isModule: boolean) {}
visit(visitor: TemplateAstVisitor, context: any): any {
// No visit method in the visitor for now...