-
Notifications
You must be signed in to change notification settings - Fork 26.4k
refacto(compiler): Error on comment only interpolations #62590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
b7f0558
to
4c98083
Compare
This commit introduces a ParserError to prevent an error later in the pipepine fixes angular#34084
4c98083
to
c2192d6
Compare
const tokens = this._lexer.tokenize(sourceToLex); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked what the AST looks like, but couldn't we check that strings.length === 0
and expressions.length === 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the unit test I provided, both aren't empty: string
actually contains 2empty string and expression
contains ' // foobar '
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm that's weird, but it's probably because we should handle comments at the lexer level rather than in the parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, although we should probably move the comment tokenization into the lexer at some point.
const tokens = this._lexer.tokenize(sourceToLex); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm that's weird, but it's probably because we should handle comments at the lexer level rather than in the parser.
const i = this._commentStart(input); | ||
return i != null ? input.substring(0, i) : input; | ||
return i != null | ||
? {hasComments: true, stripped: input.substring(0, i)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe move hasComments
to be second so the shape matches with the other variant.
This commit introduces a ParserError to prevent an error later in the pipepine
fixes #34084