Created
December 3, 2016 20:23
-
-
Save zoffixznet/79fbda2219cfb33c4b9bf3136ffed909 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
index d7595d8..2d4afe1 100644 | |
--- a/src/Perl6/Actions.nqp | |
+++ b/src/Perl6/Actions.nqp | |
@@ -4974,6 +4974,12 @@ 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 := $*W.add_object($neg-op($*W.add_object($val))); | |
+ nqp::say("Calling neg op " ~ $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=')> | |
] | |
diff --git a/src/core/Numeric.pm b/src/core/Numeric.pm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment