-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Summary Fix closed-over locals defined as part of `and`/`or` expressions not having their default value when their defined-in sub-expression was short-circuited. ## Details Bindings part of `and`/`or` expressions were so far hoisted to the start of their scope by the "unscoped def" handling in `cgirgen`, which doesn't apply to lifted locals, since these don't have a `def` (they're part of the environment object). Performing the hoisting in `transf` makes sure the behaviour of closed- over locals matches that of not closed-over ones, and it also removes the reliance on `cgirgen`. The hoisting works by scanning transformed `and`/`or` expressions for bindings that are within the *same* scope as the `and`/`or` expression, and moving them to the start of the `and`/`or` expression. For example, `(let a = 0; x) or (let b = 0; y)` is transformed into `(let a; let b; (a = 0; x) or (b = 0; y))`. Lifted globals (`.global` and `.thread`) have to be accounted for by the hoisting pass, since they weren't lifted at this point.
- Loading branch information
Showing
2 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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