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
refactor(compiler): refactor template binding parsing #23460
Conversation
A long time ago Angular used to support both those attribute notations: - `*attr='binding'` - `template=`attr: binding` Because the last notation has been dropped we can refactor the binding parsing. Source maps will benefit from that as no `attr:` prefix is added artificialy any more.
bindings.push(new TemplateBinding(this.span(start), key, keyIsVar, name, expression)); | ||
if (this.peekKeywordAs() && !keyIsVar) { | ||
|
||
bindings.push(new TemplateBinding(this.span(start), key, isVar, name, expression)); |
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.
Is there value in pushing a binding with no expression? Or is that what happens when you do *dir="let foo"
?
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.
that's exact. A var has a key and a name only (foo/$implicit)
You can preview 25bb278 at https://pr23460-25bb278.ngbuilds.io/. |
lint is failing because of an old commit message |
@@ -736,8 +729,9 @@ export class _ParseAST { | |||
if (!this.optionalCharacter(chars.$SEMICOLON)) { | |||
this.optionalCharacter(chars.$COMMA); | |||
} | |||
} | |||
return new TemplateBindingParseResult(bindings, warnings, this.errors); | |||
} while (this.index < this.tokens.length) |
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.
Missing semi colon
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
A long time ago Angular used to support both those attribute notations:
*attr='binding'
template=
attr: binding`Because the last notation has been dropped we can refactor the binding parsing.
Source maps will benefit from that as no
attr:
prefix is added artificialy anymore.