Skip to content

Commit

Permalink
[regex] avoid an unnecessary comparison
Browse files Browse the repository at this point in the history
when the index is op is used, it always returns -1 for start indexes
beyond the string length
  • Loading branch information
moritz committed Oct 19, 2013
1 parent 2c393d3 commit b8a7bbb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vm/parrot/QAST/Compiler.nqp
Expand Up @@ -1568,7 +1568,9 @@ class QAST::Compiler is HLL::Compiler {
$ops.push_pirop('index', %*REG<pos>, %*REG<tgt>, self.rxescape($node[0]), %*REG<pos>);
$ops.push_pirop('eq', %*REG<pos>, -1, %*REG<fail>);
}
$ops.push_pirop('gt', %*REG<pos>, %*REG<eos>, %*REG<fail>);
else {
$ops.push_pirop('gt', %*REG<pos>, %*REG<eos>, %*REG<fail>);
}
$ops.push_pirop('repr_bind_attr_int', %*REG<cur>, %*REG<curclass>, '"$!from"', %*REG<pos>);
$ops.push($scanlabel);
self.regex_mark($ops, $looplabel, %*REG<pos>, 0);
Expand Down

0 comments on commit b8a7bbb

Please sign in to comment.