Skip to content

Commit

Permalink
Introduce Parameter.untyped
Browse files Browse the repository at this point in the history
A parameter can lack a type, in which case it will have a type of Mu.
Checking for this alone is not enough to say whether or not a parameter
is untyped; there may be post-constraints, subsignatures, or signature
constraint with which to reject arguments. This is kind of annoying to
introspect from outside Parameter.
  • Loading branch information
Kaiepi committed Oct 14, 2021
1 parent e6a68a9 commit 034768d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core.c/Parameter.pm6
Expand Up @@ -630,6 +630,14 @@ my class Parameter { # declared in BOOTSTRAP
nqp::isnull($!signature_constraint) ?? Signature !! $!signature_constraint
}

method untyped(Parameter:D: --> Bool:D) {
nqp::hllbool(
nqp::eqaddr($!type, Mu) &&
nqp::isnull(@!post_constraints) &&
nqp::isnull($!sub_signature) &&
nqp::isnull($!signature_constraint))
}

method set_why(Parameter:D: $why --> Nil) {
$!why := $why;
}
Expand Down

0 comments on commit 034768d

Please sign in to comment.