[babel 8] Require throw expression to be wrapped in parentheses #16207
+752
−8
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.
Fixes #1, Fixes #2
There has been a lot of discussion in TC39 on what the precedence of
throw
expressions should be, and on when to require parentheses. That discussion is not settled yet, but you can read it at https://github.com/tc39/notes/blob/main/meetings/2023-09/september-26.md#throw-expressions-for-stage-3 + https://github.com/tc39/notes/blob/main/meetings/2023-09/september-28.md#throw-expression-continued (and slides at https://onedrive.live.com/view.aspx?resid=934F1675ED4C1638%21297369&authkey=!APFRcEQ8M_eUfds).This PR implements one of the alternative (i.e. only allow
throw
expressions when directly inside parentheses), and I'm opening this as a draft just to avoid loosing it in old branches on my PC.