Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #354 from peschwa/rt122229
Implement definedness checks for the JVM Binder.
  • Loading branch information
jnthn committed Jan 15, 2015
2 parents 0bb3add + 63933cd commit 9c74ab6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/vm/jvm/runtime/org/perl6/rakudo/Binder.java
Expand Up @@ -342,6 +342,39 @@ else if (desiredNative == 0) {
/* Report junction failure mode if it's a junction. */
return juncOrFail(tc, gcx, decontValue);
}

/* Also enforce definedness check */
if ( (paramFlags & SIG_ELEM_DEFINEDNES_CHECK) != 0) {

/* Don't check decontValue for concreteness though, but arg_o,
seeing as we don't have a isconcrete_nodecont */
if ((paramFlags & SIG_ELEM_UNDEFINED_ONLY) != 0 && Ops.isconcrete(arg_o, tc) == 1) {
if (error != null) {
if ((paramFlags & SIG_ELEM_INVOCANT) != 0) {
error[0] = "Invocant requires a type object, but an object instance was passed";
}
else {
error[0] = String.format(
"Parameter '%s' requires a type object, but an object instance was passed",
varName);
}
}
return juncOrFail(tc, gcx, decontValue);
}
if ((paramFlags & SIG_ELEM_DEFINED_ONLY) != 0 && Ops.isconcrete(arg_o, tc) != 1) {
if (error != null) {
if ((paramFlags & SIG_ELEM_INVOCANT) != 0) {
error[0] = "Invocant requires a instance, but a type object was passed";
}
else {
error[0] = String.format(
"Parameter '%s' requires an instance, but a type object was passed",
varName);
}
}
return juncOrFail(tc, gcx, decontValue);
}
}
}
}

Expand Down

0 comments on commit 9c74ab6

Please sign in to comment.