feat(ivy): integrate indexing pipeline with NgtscProgram (#31151)

Add an IndexingContext class to store indexing information and a
transformer module to generate indexing analysis. Integrate the indexing
module with the rest of NgtscProgram and add integration tests.

Closes #30959

PR Close #31151
This commit is contained in:
Ayaz Hafiz
2019-06-19 17:23:59 -07:00
committed by Kara Erickson
parent 3fb73ac62b
commit 74f4f5dfab
19 changed files with 749 additions and 209 deletions

View File

@ -82,7 +82,7 @@ export interface DecoratorHandler<A, M> {
* `IndexingContext`, which stores information about components discovered in the
* program.
*/
index?(context: IndexingContext, node: ClassDeclaration, metadata: M): void;
index?(context: IndexingContext, node: ClassDeclaration, metadata: A): void;
/**
* Perform resolution on the given decorator along with the result of analysis.

View File

@ -254,7 +254,16 @@ export class IvyCompilation {
/**
* Feeds components discovered in the compilation to a context for indexing.
*/
index(context: IndexingContext) { throw new Error('Method not implemented.'); }
index(context: IndexingContext) {
this.ivyClasses.forEach((ivyClass, declaration) => {
for (const match of ivyClass.matchedHandlers) {
if (match.handler.index !== undefined && match.analyzed !== null &&
match.analyzed.analysis !== undefined) {
match.handler.index(context, declaration, match.analyzed.analysis);
}
}
});
}
resolve(): void {
const resolveSpan = this.perf.start('resolve');