-
-
Save zoffixznet/b8463544f39af5fd4a684d969f4be04a 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 d7595d8..6f1336c 100644 | |
--- a/src/Perl6/Actions.nqp | |
+++ b/src/Perl6/Actions.nqp | |
@@ -4974,6 +4974,14 @@ class Perl6::Actions is HLL::Actions does STDActions { | |
my $val; | |
if nqp::can($ast,'has_compile_time_value') && $ast.has_compile_time_value { | |
$val := $ast.compile_time_value; | |
+ if $*NEGATE_VALUE { | |
+ my $neg-op := $*W.find_symbol(['&prefix:<->']); | |
+ nqp::say("Calling neg op " ~ $val.HOW.name($val) ~ " " ~ $val); | |
+ $val := $neg-op($val); | |
+ $val := $*W.add_numeric_constant( | |
+ $/, $val.HOW.name($val), $val, | |
+ ); | |
+ } | |
} | |
else { # for negatives | |
$val := ( | |
diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp | |
index 3645905..29c7ebb 100644 | |
--- a/src/Perl6/Grammar.nqp | |
+++ b/src/Perl6/Grammar.nqp | |
@@ -2946,8 +2946,8 @@ grammar Perl6::Grammar is HLL::Grammar does STD { | |
:my $*IN_DECL := ''; | |
[ | |
| <value> | |
- | <[-−]> $<value>=\d+ | |
| <sign> $<value>=['Inf'|'∞'] :my $*INF_VALUE := 1; | |
+ | [ <[-−]> :my $*NEGATE_VALUE := 1; ]? $<value>=<numish> | |
| <typename> | |
| where <.ws> <EXPR('i=')> | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment