-
-
Save niner/7d30269263f074e7cdc92e5e82bbd552 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/NativeCall.pm6 b/lib/NativeCall.pm6 | |
index e8ef82940..4d0bcf6fa 100644 | |
--- a/lib/NativeCall.pm6 | |
+++ b/lib/NativeCall.pm6 | |
@@ -43,6 +43,9 @@ my role NativeCallMangled[$name] { | |
method native_call_mangled() { $name } | |
} | |
+my role NativeCallExplicitlyManaged { | |
+} | |
+ | |
# Throwaway type just to get us some way to get at the NativeCall | |
# representation. | |
@@ -69,7 +72,7 @@ sub param_hash_for(Parameter $p) { | |
if $type ~~ Str { | |
my $enc := $p.?native_call_encoded() || 'utf8'; | |
nqp::bindkey($result, 'type', nqp::unbox_s(string_encoding_to_nci_type($enc))); | |
- nqp::bindkey($result, 'free_str', nqp::unbox_i(1)); | |
+ nqp::bindkey($result, 'free_str', nqp::unbox_i($p ~~ NativeCallExplicitlyManaged ?? 0 !! 1)); | |
} | |
elsif $type ~~ Callable { | |
nqp::bindkey($result, 'type', nqp::unbox_s(type_code_for($type))); | |
@@ -617,6 +620,9 @@ multi trait_mod:<is>(Routine $r, :$nativeconv!) is export(:DEFAULT, :traits) { | |
multi trait_mod:<is>(Parameter $p, :$encoded!) is export(:DEFAULT, :traits) { | |
$p does NativeCallEncoded[$encoded]; | |
} | |
+multi trait_mod:<is>(Parameter $p, :$explicitly-managed!) is export(:DEFAULT, :traits) { | |
+ $p does NativeCallExplicitlyManaged; | |
+} | |
multi trait_mod:<is>(Routine $p, :$encoded!) is export(:DEFAULT, :traits) { | |
$p does NativeCallEncoded[$encoded]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment