-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Description
Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
Yes
Description
Location information for TemplateLiteralElement are wrong.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
import { Lexer, Parser } from '@angular/compiler';
const parse = (text) => {
const lexer = new Lexer();
const parser = new Parser(lexer);
return parser.parseBinding(text, '', 0);
};
console.log(parse('`a${b}c`').ast.elements);
[
TemplateLiteralElement {
span: ParseSpan { start: 0, end: 0 },
sourceSpan: AbsoluteSourceSpan { start: 0, end: 0 },
text: 'a'
},
TemplateLiteralElement {
span: ParseSpan { start: 6, end: 6 },
sourceSpan: AbsoluteSourceSpan { start: 6, end: 6 },
text: 'c'
}
]
Please provide the environment you discovered this bug in (run ng version)
@angular/compiler 19.2.1
Anything else?
I'm adding support to Prettier prettier/prettier#17238 .
In angular-estree-parser which used in Prettier, I'm locating the TemplateLiteralElement by the sibling expressions.
Correct location information can help us get ride of this hack.
Related issue #60319