Skip to content

Commit 4fb5124

Browse files
committed
Avoid vtable_bool for determining whether subrule passed/failed.
1 parent dc942fb commit 4fb5124

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/QAST/Compiler.nqp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,12 @@ class QAST::Compiler is HLL::Compiler {
365365
my @pargs := $cpn[1] // [];
366366
my @nargs := $cpn[2] // [];
367367
my $subpost := nqp::shift(@pargs);
368-
my $testop := $node.negate ?? 'if' !! 'unless';
368+
my $testop := $node.negate ?? 'ge' !! 'lt';
369369
$ops.push($cpn[0]);
370370
$ops.push_pirop('repr_bind_attr_int', %*REG<cur>, %*REG<curclass>, '"$!pos"', %*REG<pos>);
371371
$ops.push_pirop('callmethod', $subpost, %*REG<cur>, |@pargs, |@nargs, :result<$P11>);
372-
$ops.push_pirop($testop, '$P11', %*REG<fail>);
372+
$ops.push_pirop('repr_get_attr_int', '$I11', '$P11', %*REG<curclass>, '"$!pos"');
373+
$ops.push_pirop($testop, '$I11', '0', %*REG<fail>);
373374
$ops.push_pirop('callmethod', '"!cursor_capture"', %*REG<cur>,
374375
'$P11', $name, :result(%*REG<cstack>))
375376
if $subtype eq 'capture';

0 commit comments

Comments
 (0)