Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RakuAST: add sorry for using placeholder when not allowed
When a placeholder is encountered, check whether the signature of the placeholder owner already has an instantiated parameters list. If it has, then add a X::Signature::Placeholder sorry. Except if the placeholder name is '@_' or '%_': if *these* occur in the parameters list, then they're ok: sub (*@_) { @_ } # valid sub (*@A) { @_ } # *NOT* valid sub () { @_ } # *NOT* valid sub { @_ } # valid This is achieved by a bit of a refactor on Signature.parameters. If not specified at creation of the Signature, then it will remain undefined to indicate no actual parameters are known yet. The Signature.parameters-initialized method can be used to check that. Internally, if defined, the $!parameters attribute now contains a low-level list, which means that accesses for looping on that will need an extra check. But on the other hand, would not need unwrapping. The Signature.parameters method returns a HLL List as before, and the parameters argument with .new also assumes a HLL List to be given. This adds a PERFORM-CHECK to RakuAST::VarDeclaration::Placeholder that does all of the checking.
- Loading branch information
Showing
2 changed files
with
67 additions
and
21 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