Skip to content

Commit a7352d1

Browse files
committed
Start moving caps into the code object.
1 parent 384651d commit a7352d1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/NQP/Actions.pm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,4 +1636,8 @@ class NQP::RegexActions is QRegex::P6Regex::Actions {
16361636
method store_regex_nfa($code_obj, $block, $nfa) {
16371637
$code_obj.SET_NFA($nfa.save);
16381638
}
1639+
1640+
method store_regex_caps($code_obj, $block, %caps) {
1641+
$code_obj.SET_CAPS(%caps);
1642+
}
16391643
}

src/QRegex/Cursor.nqp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ role NQPCursorRole is export {
2828
my $name;
2929

3030
if !nqp::isnull($!regexsub) && $!regexsub {
31-
%caplist := $!regexsub.nqpattr('caps');
31+
%caplist := nqp::ifnull(
32+
nqp::can($!regexsub, 'CAPS') ?? $!regexsub.CAPS() !! nqp::null(),
33+
$!regexsub.nqpattr('caps'));
3234
if !nqp::isnull(%caplist) && %caplist {
3335
$iter := nqp::iterator(%caplist);
3436
while $iter {

0 commit comments

Comments
 (0)