Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RakuAST: move role body tweaking logic to RakuAST::Package class
The reason for this is simple: we can not expect a developer that creates a new RakuAST::Package(:declarator<role>) object to know that the body of the role should really be a sub, and that it should have a signature matching the intended parameterization of the role. This commit: - moves the body tweaking logic to the "replace-body" method - and adds an argument for the Signature to be used for parameterization - adds a :parameterization argument to .new - let's the .new method call the "replace-body" method to set the body This now allows a role to be created using RakuAST:: classes *without* needing to know the required internal tweaking. Rakufication and deparsing have already earlier been adapted to hide this internal tweaking, so that we now can roundtrip the RakuAST code for a role.
- Loading branch information
Showing
2 changed files
with
40 additions
and
22 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