Skip to content

Commit 2da67f4

Browse files
committed
Update quote:sym</ /> actions. We can now do things like say('b33r' ~~ /\d+/) again.
1 parent 3611d39 commit 2da67f4

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/NQPQ/Actions.pm

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,21 +1273,23 @@ class NQP::Actions is HLL::Actions {
12731273
:node($/) );
12741274
}
12751275

1276-
method quote:sym</ />($/, $key?) {
1277-
if $key eq 'open' {
1278-
$Regex::P6Regex::Actions::REGEXNAME := pir::null__P();
1279-
@BLOCK[0].symbol('', :scope('lexical'));
1280-
@BLOCK[0].symbol('$/', :scope('lexical'));
1281-
return 0;
1282-
}
1283-
my $regex :=
1284-
Regex::P6Regex::Actions::buildsub($<p6regex>.ast, @BLOCK.shift);
1285-
my $past :=
1286-
PAST::Op.new(
1287-
:pasttype<callmethod>, :name<new>,
1288-
lexical_package_lookup(['Regex', 'Regex'], $/),
1289-
$regex
1290-
);
1276+
method quote:sym</ />($/) {
1277+
my $block := @BLOCK.shift;
1278+
$block[0].push(PAST::Var.new(:name<self>, :scope<parameter>));
1279+
$block[0].push(
1280+
PAST::Var.new(:name<self>, :scope<register>, :isdecl(1),
1281+
:viviself(PAST::Var.new( :name<self>, :scope('lexical_6model') ))));
1282+
$block[0].push(PAST::Var.new(:name<>, :scope<lexical>, :isdecl(1)));
1283+
$block[0].push(PAST::Var.new(:name<$/>, :scope<lexical>, :isdecl(1)));
1284+
$block.symbol('', :scope<lexical>);
1285+
$block.symbol('$/', :scope<lexical>);
1286+
1287+
my $regex := QRegex::P6Regex::Actions::buildsub($<p6regex>.ast, $block);
1288+
my $past := PAST::Op.new(
1289+
:pasttype<callmethod>, :name<new>,
1290+
lexical_package_lookup(['NQPRegex'], $/),
1291+
$regex);
1292+
12911293
# In sink context, we don't need the Regex::Regex object.
12921294
$past<sink> := $regex;
12931295
make $past;

0 commit comments

Comments
 (0)