Skip to content

Instantly share code, notes, and snippets.

@timo

timo/patch.diff Secret

Created August 6, 2016 21:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save timo/306af382ad5a1f8b66adcee47abf12d9 to your computer and use it in GitHub Desktop.
commit b8a140d54ca4b4524fb08244ab3444e26edcb099
Author: Timo Paulssen <timonator@perpetuum-immobile.de>
Date: Tue Mar 3 20:51:42 2015 +0100
make @ and % sigiled vars have :D by default
sadly messes up one test where the optimizer should have
complained about an impossible call (S06-signature/errors.t)
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index 3ab2eed..865589a 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -3668,14 +3668,17 @@ class Perl6::Actions is HLL::Actions does STDActions {
# Depending on sigil, use appropriate role.
my int $need_role;
+ my int $need_defined;
my $role_type;
if $sigil eq '@' {
$role_type := $*W.find_symbol(['Positional']);
$need_role := 1;
+ $need_defined := 1;
}
elsif $sigil eq '%' {
$role_type := $*W.find_symbol(['Associative']);
$need_role := 1;
+ $need_defined := 1;
}
elsif $sigil eq '&' {
$role_type := $*W.find_symbol(['Callable']);
@@ -3689,6 +3692,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
else {
%*PARAM_INFO<nominal_type> := $role_type;
}
+ %*PARAM_INFO<defined_only> := 1 if $need_defined;
}
# Handle twigil.
diff --git a/src/core/Parameter.pm b/src/core/Parameter.pm
index 9ea3fc9..88f3a92 100644
--- a/src/core/Parameter.pm
+++ b/src/core/Parameter.pm
@@ -168,7 +168,8 @@ my class Parameter { # declared in BOOTSTRAP
else {
$perl = $type;
}
- if $!flags +& $SIG_ELEM_DEFINED_ONLY {
+ if $!flags +& $SIG_ELEM_DEFINED_ONLY &&
+ !($!flags +& ($SIG_ELEM_ARRAY_SIGIL +| $SIG_ELEM_HASH_SIGIL)) {
$perl ~= ':D';
} elsif $!flags +& $SIG_ELEM_UNDEFINED_ONLY {
$perl ~= ':U';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment