feat(ivy): add error reporting to the html to ivy transformer (#23546)
PR Close #23546
This commit is contained in:

committed by
Igor Minar

parent
46674d5fac
commit
08e7efc69e
@ -29,12 +29,13 @@ const ANIMATE_PROP_PREFIX = 'animate-';
|
||||
*/
|
||||
export class BindingParser {
|
||||
pipesByName: Map<string, CompilePipeSummary>|null = null;
|
||||
|
||||
private _usedPipes: Map<string, CompilePipeSummary> = new Map();
|
||||
|
||||
constructor(
|
||||
private _exprParser: Parser, private _interpolationConfig: InterpolationConfig,
|
||||
private _schemaRegistry: ElementSchemaRegistry, pipes: CompilePipeSummary[]|null,
|
||||
private _targetErrors: ParseError[]) {
|
||||
public errors: ParseError[]) {
|
||||
// When the `pipes` parameter is `null`, do not check for used pipes
|
||||
// This is used in IVY when we might not know the available pipes at compile time
|
||||
if (pipes) {
|
||||
@ -364,7 +365,7 @@ export class BindingParser {
|
||||
private _reportError(
|
||||
message: string, sourceSpan: ParseSourceSpan,
|
||||
level: ParseErrorLevel = ParseErrorLevel.ERROR) {
|
||||
this._targetErrors.push(new ParseError(sourceSpan, message, level));
|
||||
this.errors.push(new ParseError(sourceSpan, message, level));
|
||||
}
|
||||
|
||||
private _reportExpressionParserErrors(errors: ParserError[], sourceSpan: ParseSourceSpan) {
|
||||
|
@ -59,18 +59,6 @@ const CLASS_ATTR = 'class';
|
||||
|
||||
const TEXT_CSS_SELECTOR = CssSelector.parse('*')[0];
|
||||
|
||||
let warningCounts: {[warning: string]: number} = {};
|
||||
|
||||
function warnOnlyOnce(warnings: string[]): (warning: ParseError) => boolean {
|
||||
return (error: ParseError) => {
|
||||
if (warnings.indexOf(error.msg) !== -1) {
|
||||
warningCounts[error.msg] = (warningCounts[error.msg] || 0) + 1;
|
||||
return warningCounts[error.msg] <= 1;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
export class TemplateParseError extends ParseError {
|
||||
constructor(message: string, span: ParseSourceSpan, level: ParseErrorLevel) {
|
||||
super(span, message, level);
|
||||
|
Reference in New Issue
Block a user