-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mypyc] Refactor method IR generation (#9846)
Add new helpers for generating methods that reduces the required boilerplate. Switch several existing use cases to use the new helpers. Summary of the new helpers: 1. Call `builder.enter_method(...)` to begin generating IR for a method. 2. Call `builder.add_argument(..)` for each non-self argument. 3. Generate method body normally. 4. Call `builder.leave_method()`. Previously `enter()` and `leave()` had to be used, along with several additional steps, such as defining `self` explicitly. The new approach is much easier to use and less error-prone. Since not all uses of the old interface have been removed, there is still some duplication. It would be great to eventually always use the higher-level interface to generate methods and functions. Work on mypyc/mypyc#781.
- Loading branch information
Showing
10 changed files
with
151 additions
and
174 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
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
Oops, something went wrong.