Skip to content
Permalink
Browse files

[JVM] Use default value for optional native param

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 96a976b347762774c40b08e4d5da3dec497fcb55
Showing with 12 additions and 1 deletion.
  1. +12 −1 src/vm/jvm/runtime/org/perl6/rakudo/Binder.java
@@ -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);
}
}
}
}

0 comments on commit 96a976b

Please sign in to comment.
You can’t perform that action at this time.