feat(compiler): support nullish coalescing in templates by crisbeto · Pull Request #41437 · angular/angular

@crisbeto crisbeto marked this pull request as ready for review

April 3, 2021 16:31

AndrewKushnir

@crisbeto

Adds support for nullish coalescing expressions inside of Angular templates (e.g. `{{ a ?? b ?? c}}`).

Fixes angular#36528.

@crisbeto

AndrewKushnir

crisbeto added a commit to crisbeto/angular that referenced this pull request

Apr 13, 2021
… 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.

zarend pushed a commit that referenced this pull request

Apr 14, 2021
… 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

zarend pushed a commit that referenced this pull request

Apr 14, 2021
… 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