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)
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.
https://github.com/prettier/angular-estree-parser/blob/72bfe63e0f237527726819a0401b9be5c26071f8/src/transform-node.ts#L558-L575
Correct location information can help us get ride of this hack.
Related issue #60319
Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
Yes
Description
Location information for
TemplateLiteralElementare wrong.Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in (run
ng version)Anything else?
I'm adding support to Prettier prettier/prettier#17238 .
In
angular-estree-parserwhich used in Prettier, I'm locating theTemplateLiteralElementby the sibling expressions.https://github.com/prettier/angular-estree-parser/blob/72bfe63e0f237527726819a0401b9be5c26071f8/src/transform-node.ts#L558-L575
Correct location information can help us get ride of this hack.
Related issue #60319