Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ChrisDodd
Copy link
Contributor

Various transforms replace statements with other statements, often using inlineBlock to properly inline into a containing block. It turns out when returning a single (non-block) statement, it still needs to be wrapped in a BlockStatement if the parent is a SwitchCase.

@ChrisDodd ChrisDodd requested review from asl, fruffy and vlstill July 14, 2025 00:30
@ChrisDodd ChrisDodd force-pushed the cdodd-switchcasechild branch from 661ba1f to e3ab1c5 Compare July 14, 2025 02:21
@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label Jul 14, 2025
@ChrisDodd ChrisDodd force-pushed the cdodd-switchcasechild branch 3 times, most recently from ede08a1 to 72721ae Compare July 15, 2025 03:19
@ChrisDodd ChrisDodd force-pushed the cdodd-switchcasechild branch from 72721ae to ac17660 Compare July 22, 2025 00:42
Various transforms replace statements with other statements, often using
inlineBlock to properly inline into a containing block.  It turns out
when returning a single (non-block) statement, it still needs to be
wrapped in a BlockStatement if the parent is a SwitchCase.

Signed-off-by: Chris Dodd <[email protected]>
@ChrisDodd
Copy link
Contributor Author

@asl @vlstill @fruffy This is a fairly striaght-forward bug fix with no effect on the language. The only reason the restriction in the IR is relevant is that the language requires explicit {..} for each switch case, and we want to be able to dump IR as P4 source. We could relax the restriction in the IR and add the {..} when we generate IR instead, but the difference in the IR details is probably not relevant anywhere.

@ChrisDodd ChrisDodd added this pull request to the merge queue Jul 23, 2025
Merged via the queue into p4lang:main with commit d03f708 Jul 23, 2025
20 checks passed
@ChrisDodd ChrisDodd deleted the cdodd-switchcasechild branch July 23, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Topics concerning the core segments of the compiler (frontend, midend, parser)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants