Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
nqp-jvm doesn't like negative nums in substr
  • Loading branch information
timo committed Aug 20, 2013
1 parent ba977c2 commit 8bea225
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/NQP/Optimizer.nqp
Expand Up @@ -45,7 +45,9 @@ class NQP::Optimizer {
return 1
}
if nqp::istype($node, QAST::Op) {
my $typeinfo := nqp::substr($node.op, nqp::chars($node.op) - 2, 2);
my $typeinfo := nqp::chars($node.op) >= 2
?? nqp::substr($node.op, nqp::chars($node.op) - 2, 2)
!! "";
if $typeinfo eq "_i" {
return 1
} elsif $node.op eq 'chars' || $node.op eq 'ord' {
Expand All @@ -70,7 +72,9 @@ class NQP::Optimizer {
}
self.visit_children($op);

my $typeinfo := nqp::substr($op.op, nqp::chars($op.op) - 2, 2);
my $typeinfo := nqp::chars($op.op) >= 2
?? nqp::substr($op.op, nqp::chars($op.op) - 2, 2)
!! "";
my $asm := nqp::substr($op.op, 0, 3);

try {
Expand Down

0 comments on commit 8bea225

Please sign in to comment.