Created
March 8, 2017 21:18
-
-
Save jnthn/9e43772eef65d86d42c9a6526418c9b2 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/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp | |
index 4c131f1..ca2745a 100644 | |
--- a/src/Perl6/Actions.nqp | |
+++ b/src/Perl6/Actions.nqp | |
@@ -8353,12 +8353,10 @@ class Perl6::Actions is HLL::Actions does STDActions { | |
# If it's optional, do any default handling. | |
if $flags +& $SIG_ELEM_IS_OPTIONAL { | |
- if nqp::existskey(%info, 'default_value') { | |
- my $wval := QAST::WVal.new( :value(%info<default_value>) ); | |
- if %info<default_is_literal> { | |
- $var.default($wval); | |
- } | |
- else { | |
+ my $default_value := nqp::getattr($param_obj, $Param, '$!default_value'); | |
+ if !nqp::isnull($default_value) { | |
+ my $wval := QAST::WVal.new( :value($default_value) ); | |
+ if nqp::istype($default_value, $*W.find_symbol(['Block'], :setting-only)) { | |
$var.default(QAST::Op.new( | |
:op('call'), | |
QAST::Op.new( | |
@@ -8366,6 +8364,9 @@ class Perl6::Actions is HLL::Actions does STDActions { | |
QAST::Op.new( :op('callmethod'), :name('clone'), $wval ) | |
))); | |
} | |
+ else { | |
+ $var.default($wval); | |
+ } | |
} | |
else { | |
if %info<sigil> eq '@' { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment