Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

steal match widening from rakudo-debugger

now "23 + 4" in sink context reports the whole expression, not just the operator
  • Loading branch information...
commit a5a3718e451dc764887c438a91deccfafb23afab 1 parent f6a731c
@moritz moritz authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 src/Perl6/Optimizer.pm
View
11 src/Perl6/Optimizer.pm
@@ -323,9 +323,18 @@ class Perl6::Optimizer {
$survived := 0;
}
}
+ sub widen($m) {
+ my int $from := $m.from;
+ my int $to := $m.to;
+ for $m.list {
+ $from := $_.from if $_.from < $from;
+ $to := $_.to if $_.to > $to;
+ }
+ nqp::substr($m.orig, $from, $to - $from);
+ }
if $survived {
if $op.node && $*VOID_CONTEXT && !$*IN_DECLARATION {
- my str $text := nqp::escape($op.node.Str);
+ my str $text := nqp::escape(widen($op.node));
self.add_worry($op, qq[Useless use of constant expression "$text" in sink context]);
return $NULL;
Please sign in to comment.
Something went wrong with that request. Please try again.