-
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.
cgirgen: remove the
var
expression fixup (#1482)
## Summary Remove a fixup in `cgirgen` related to `var` parameters in `cgirgen` and correct the AST construction necessitating it. There's no change in language semantics. ## Details In typed `PNode` AST, `var` parameters *always* have to be dereferenced first, including when being passed to other `var` parameters (resulting in `(HiddenAddr (HiddenDeref x))` trees). Multiple transformations / places where AST is constructed in the compiler didn't produce AST adhering to this. The result was incorrect MIR code being generated (because the location *storing* the `var` parameter was being passed to another parameter, not the location the `var` parameter *references*), though this didn't cause any trouble so far. `cgirgen` detected this situation and adjusted its output accordingly, producing well-formed CGIR AST. The sources of the problematic `PNode` AST were: * parameter hoisting in `semexprs` * hook lifting in `liftdestructors` * method dispatcher generation in `cgmeth` They're changed to produce AST adhering to the aforementioned requirements, and the fixup in `cgirgen` is removed. --------- Co-authored-by: Saem Ghani <saemghani+github@gmail.com>
- Loading branch information
Showing
4 changed files
with
35 additions
and
32 deletions.
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
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