mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
refactor(compiler-cli): Update where and how the indexed errors are exposed (#44884)
The initial commit e9124b42d5 stored the errors rather than
throwing but did not store them in a place that was accessible to consumers. Instead,
the errors should be added to the IndexedComponent so they can be surfaced where the
index results are consumed
PR Close #44884
This commit is contained in:
committed by
Jessica Janiuk
parent
94c9e47dbe
commit
47c02caa29
@@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import {ParseSourceFile} from '@angular/compiler';
|
||||
|
||||
import {ClassDeclaration, DeclarationNode} from '../../reflection';
|
||||
|
||||
/**
|
||||
@@ -135,4 +136,5 @@ export interface IndexedComponent {
|
||||
isInline: boolean,
|
||||
file: ParseSourceFile;
|
||||
};
|
||||
errors: Error[];
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import {getTemplateIdentifiers} from './template';
|
||||
*/
|
||||
export function generateAnalysis(context: IndexingContext): Map<DeclarationNode, IndexedComponent> {
|
||||
const analysis = new Map<DeclarationNode, IndexedComponent>();
|
||||
const analysisErrors: Error[] = [];
|
||||
|
||||
context.components.forEach(({declaration, selector, boundTemplate, templateMeta}) => {
|
||||
const name = declaration.name.getText();
|
||||
@@ -47,7 +46,6 @@ export function generateAnalysis(context: IndexingContext): Map<DeclarationNode,
|
||||
}
|
||||
|
||||
const {identifiers, errors} = getTemplateIdentifiers(boundTemplate);
|
||||
analysisErrors.push(...errors);
|
||||
analysis.set(declaration, {
|
||||
name,
|
||||
selector,
|
||||
@@ -58,6 +56,7 @@ export function generateAnalysis(context: IndexingContext): Map<DeclarationNode,
|
||||
isInline: templateMeta.isInline,
|
||||
file: templateFile,
|
||||
},
|
||||
errors,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ runInEachFileSystem(() => {
|
||||
usedComponents: new Set(),
|
||||
isInline: false,
|
||||
file: new ParseSourceFile('<div>{{foo}}</div>', decl.getSourceFile().fileName),
|
||||
}
|
||||
},
|
||||
errors: [],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user