Skip to content

Commit

Permalink
[JVM] Use default value for optional native param
Browse files Browse the repository at this point in the history
This makes 'sub (num $v?) { $v }()' work as expected by
MISC/misc-6.d.t
  • Loading branch information
usev6 committed Apr 7, 2019
1 parent 728ed87 commit 96a976b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/vm/jvm/runtime/org/perl6/rakudo/Binder.java
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,18 @@ else if ((flags & SIG_ELEM_HASH_SIGIL) != 0) {
return res;
}
else {
return param.get_attribute_boxed(tc, gcx.Parameter, "$!nominal_type", HINT_nominal_type);
param.get_attribute_native(tc, gcx.Parameter, "$!flags", HINT_flags);
int paramFlags = (int)tc.native_i;
switch (paramFlags & SIG_ELEM_NATIVE_VALUE) {
case SIG_ELEM_NATIVE_INT_VALUE:
return createBox(tc, gcx, (long)0, CallSiteDescriptor.ARG_INT);
case SIG_ELEM_NATIVE_NUM_VALUE:
return createBox(tc, gcx, (double)0.0, CallSiteDescriptor.ARG_NUM);
case SIG_ELEM_NATIVE_STR_VALUE:
return createBox(tc, gcx, null, CallSiteDescriptor.ARG_STR);
default:
return param.get_attribute_boxed(tc, gcx.Parameter, "$!nominal_type", HINT_nominal_type);
}
}
}
}
Expand Down

0 comments on commit 96a976b

Please sign in to comment.