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
feat(compiler): support nullish coalescing in templates #41437
Conversation
68a9ed7
to
20ba227
Compare
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.
Looks great, thanks @crisbeto 👍
I've started a presubmit to see if there are some cases that may require additional attention and will let you know.
...iance/test_cases/r3_view_compiler/nullish_coalescing/nullish_coalescing_property_template.js
Show resolved
Hide resolved
Quick update: presubmit looks good, I will also run a global one (TGP) tonight and will keep this thread updated. Thank you. |
FYI, global presubmit was successful as well, so I'm removing the "presubmit" label, which makes this PR fully ready for merge! |
Adds support for nullish coalescing expressions inside of Angular templates (e.g. `{{ a ?? b ?? c}}`). Fixes angular#36528.
20ba227
to
c117c0d
Compare
I've rebased and pushed another commit with more tests for host bindings. |
c117c0d
to
0cf599a
Compare
0cf599a
to
67f4d57
Compare
… nullish coalescing This is follow-up from angular#41437 and it reduces the amount of code we generate for safe property accesses (`a?.b`) and nullish coalescing (`a ?? b`) by: 1. Reusing variables in nested nullish coalescing expressions. 2. Not initializing temporary variables to `null`. The way our code is generated means that the value will always be overwritten before we compare against it so the initializer didn't really matter. Fixes angular#41491.
… nullish coalescing This is follow-up from angular#41437 and it reduces the amount of code we generate for safe property accesses (`a?.b`) and nullish coalescing (`a ?? b`) by: 1. Reusing variables in nested nullish coalescing expressions. 2. Not initializing temporary variables to `null`. The way our code is generated means that the value will always be overwritten before we compare against it so the initializer didn't really matter. Fixes angular#41491.
… nullish coalescing This is follow-up from angular#41437 and it reduces the amount of code we generate for safe property accesses (`a?.b`) and nullish coalescing (`a ?? b`) by: 1. Reusing variables in nested nullish coalescing expressions. 2. Not initializing temporary variables to `null`. The way our code is generated means that the value will always be overwritten before we compare against it so the initializer didn't really matter. Fixes angular#41491.
… nullish coalescing (#41563) This is follow-up from #41437 and it reduces the amount of code we generate for safe property accesses (`a?.b`) and nullish coalescing (`a ?? b`) by: 1. Reusing variables in nested nullish coalescing expressions. 2. Not initializing temporary variables to `null`. The way our code is generated means that the value will always be overwritten before we compare against it so the initializer didn't really matter. Fixes #41491. PR Close #41563
… nullish coalescing (#41563) This is follow-up from #41437 and it reduces the amount of code we generate for safe property accesses (`a?.b`) and nullish coalescing (`a ?? b`) by: 1. Reusing variables in nested nullish coalescing expressions. 2. Not initializing temporary variables to `null`. The way our code is generated means that the value will always be overwritten before we compare against it so the initializer didn't really matter. Fixes #41491. PR Close #41563
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. |
Adds support for nullish coalescing expressions inside of Angular templates (e.g.
{{ a ?? b ?? c}}
).Fixes #36528.