-
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?
No
Description
No correct start location when there is no expression
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('`abc`').ast)ASTWithSource {
span: ParseSpan { start: 0, end: 6 },
sourceSpan: AbsoluteSourceSpan { start: 0, end: 6 },
ast: TemplateLiteral {
span: ParseSpan { start: 6, end: 6 },
sourceSpan: AbsoluteSourceSpan { start: 6, end: 6 },
elements: [ [TemplateLiteralElement] ],
expressions: []
},
source: '`abcd`',
location: '',
errors: []
}
There is no clue where it starts, since characters can be encoded, I can't use the cooked text value to locate.
Please provide the environment you discovered this bug in (run ng version)
@angular/compiler 19.2.1
Anything else?
I'm trying to add support in Prettier. prettier/prettier#17238
Related issue #60320