Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Store return type object for callbacks.

  • Loading branch information...
commit 2f3cfad9c56b64893005a3db96cd3c3921f3d5c1 1 parent dc75c36
@arnsholt arnsholt authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/NativeCall.pm6
View
5 lib/NativeCall.pm6
@@ -27,7 +27,7 @@ sub param_hash_for(Parameter $p, :$with-typeobj) {
elsif $type ~~ Callable {
nqp::bindkey($result, 'type', nqp::unbox_s(type_code_for($p.type)));
my $info := param_list_for($p.sub_signature, :with-typeobj);
- nqp::unshift($info, return_hash_for($p.sub_signature));
+ nqp::unshift($info, return_hash_for($p.sub_signature, :with-typeobj));
nqp::bindkey($result, 'callback_args', $info);
}
else {
@@ -47,9 +47,10 @@ sub param_list_for(Signature $sig, :$with-typeobj) {
}
# Builds a hash of type information for the specified return type.
-sub return_hash_for(Signature $s, &r?) {
+sub return_hash_for(Signature $s, &r?, :$with-typeobj) {
my Mu $result := nqp::hash();
my $returns := $s.returns;
+ nqp::bindkey($result, 'typeobj', $returns) if $with-typeobj;
if $returns ~~ Str {
my $enc := &r.?native_call_encoded() || 'utf8';
nqp::bindkey($result, 'type', nqp::unbox_s(string_encoding_to_nci_type($enc)));
Please sign in to comment.
Something went wrong with that request. Please try again.