Project control flow branches individually#54921
Closed
crisbeto wants to merge 4 commits intoangular:mainfrom
Closed
Project control flow branches individually#54921crisbeto wants to merge 4 commits intoangular:mainfrom
crisbeto wants to merge 4 commits intoangular:mainfrom
Conversation
This commit changes the way we use containers to insert conditional content. Previously if and switch conditional would always use the first content as the insertion container. This strategy interfered with content projection that projects entire containers - as the consequence content for _all_ cases would end up in slot matched by the first container. This could be very surprising as desicribed in angular#54840 After the change each conditional content is projected into its own container. This means that content projection can match more than one container and result in correct display. Fixes angular#54840
…on in if blocks Previously only the first branch of an `if` block was captured for content projection. This was done because of some planned refactors in the future. Since we've decided not to apply those refactors to conditionals, these changes update the compiler to capture each branch individually for content projection purposes.
Captures the individual cases in `switch` blocks for content projection purposes.
Updates the logic that detects if a node should be checked for control flow content projection to exit as soon as it detects a second root node, instead of counting the total and then checking if it's more than one.
dylhunn
approved these changes
Mar 20, 2024
Contributor
dylhunn
left a comment
There was a problem hiding this comment.
reviewed-for: fw-compiler
Contributor
|
This PR was merged into the repository by commit fc13144. |
dylhunn
pushed a commit
that referenced
this pull request
Mar 22, 2024
…on in if blocks (#54921) Previously only the first branch of an `if` block was captured for content projection. This was done because of some planned refactors in the future. Since we've decided not to apply those refactors to conditionals, these changes update the compiler to capture each branch individually for content projection purposes. PR Close #54921
dylhunn
pushed a commit
that referenced
this pull request
Mar 22, 2024
) Captures the individual cases in `switch` blocks for content projection purposes. PR Close #54921
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Includes the following changes to allow the branches of
ifblocks to be projected individually and forcaseanddefaultblock contents to be projected.fix(core): correctly project single-root content inside control flow
This commit changes the way we use containers to insert conditional content. Previously if and switch conditional would always use the first content as the insertion container. This strategy interfered with content projection that projects entire containers - as the consequence content for all cases would end up in slot matched by the first container. This could be very surprising as described in #54840
After the change each conditional content is projected into its own container. This means that content projection can match more than one container and result in correct display.
fix(compiler): capture all control flow branches for content projection in if blocks
Previously only the first branch of an
ifblock was captured for content projection. This was done because of some planned refactors in the future. Since we've decided not to apply those refactors to conditionals, these changes update the compiler to capture each branch individually for content projection purposes.fix(compiler): capture switch block cases for content projection
Captures the individual cases in
switchblocks for content projection purposes.refactor(compiler-cli): exit early when checking content projection
Updates the logic that detects if a node should be checked for control flow content projection to exit as soon as it detects a second root node, instead of counting the total and then checking if it's more than one.
Fixes #54840.