Skip to content

Commit 3ff2502

Browse files
committed
Even if we captured nothing, we should still put empty RPAs into the caphash for quantified matches, so the match object gets the correct structure.
1 parent db4f73c commit 3ff2502

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/QRegex/Cursor.nqp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ role NQPCursorRole {
1616

1717
method CAPHASH() {
1818
my $caps := nqp::hash();
19+
my %caplist := $!regexsub.nqpattr('caps');
20+
for %caplist {
21+
$caps{$_.key} := nqp::list() if $_.value >= 2;
22+
}
1923
if $!cstack {
20-
my %caplist := $!regexsub.nqpattr('caps');
21-
for %caplist {
22-
$caps{$_.key} := nqp::list() if $_.value >= 2;
23-
}
2424
for $!cstack -> $subcur {
2525
my $submatch := $subcur.MATCH;
2626
for nqp::split('=', nqp::getattr($subcur, $?CLASS, '$!name')) -> $name {

0 commit comments

Comments
 (0)