fix(compiler-cli): produce diagnostic messages in expression of PrefixNot node. (#33087)
PR Close #33087
This commit is contained in:
parent
f54adf10b5
commit
2ddc851090
|
@ -304,6 +304,10 @@ export class AstType implements AstVisitor {
|
||||||
}
|
}
|
||||||
|
|
||||||
visitPrefixNot(ast: PrefixNot) {
|
visitPrefixNot(ast: PrefixNot) {
|
||||||
|
// If we are producing diagnostics, visit the children
|
||||||
|
if (this.diagnostics) {
|
||||||
|
visitAstChildren(ast, this);
|
||||||
|
}
|
||||||
// The type of a prefix ! is always boolean.
|
// The type of a prefix ! is always boolean.
|
||||||
return this.query.getBuiltinType(BuiltinType.Boolean);
|
return this.query.getBuiltinType(BuiltinType.Boolean);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,9 @@ describe('expression diagnostics', () => {
|
||||||
() => reject(
|
() => reject(
|
||||||
'<div *ngIf="persson">{{person.name.first}}</div>',
|
'<div *ngIf="persson">{{person.name.first}}</div>',
|
||||||
'Identifier \'persson\' is not defined'));
|
'Identifier \'persson\' is not defined'));
|
||||||
|
it('should reject *ngIf of misspelled identifier in PrefixNot node',
|
||||||
|
() =>
|
||||||
|
reject('<div *ngIf="people && !persson"></div>', 'Identifier \'persson\' is not defined'));
|
||||||
it('should accept an *ngFor', () => accept(`
|
it('should accept an *ngFor', () => accept(`
|
||||||
<div *ngFor="let p of people">
|
<div *ngFor="let p of people">
|
||||||
{{p.name.first}} {{p.name.last}}
|
{{p.name.first}} {{p.name.last}}
|
||||||
|
|
Loading…
Reference in New Issue