Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid name leakage that led to action methods get invoked at weird ti…

…mes.
  • Loading branch information...
commit f5994485680fcfe7edff5b66d7a5eb6f4ff246c2 1 parent 2c0f695
@jnthn jnthn authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/QRegex/P6Regex/Actions.nqp
View
10 src/QRegex/P6Regex/Actions.nqp
@@ -120,7 +120,7 @@ class QRegex::P6Regex::Actions is HLL::Actions {
}
method metachar:sym<( )>($/) {
- my $subpast := PAST::Node.new(buildsub($<nibbler>.ast));
+ my $subpast := PAST::Node.new(buildsub($<nibbler>.ast, :anon(1)));
my $qast := QAST::Regex.new( $subpast, $<nibbler>.ast, :rxtype('subrule'),
:subtype('capture'), :node($/) );
make $qast;
@@ -343,7 +343,7 @@ class QRegex::P6Regex::Actions is HLL::Actions {
for $<arglist>[0].ast.list { $qast[0].push( $_ ) }
}
elsif $<nibbler> {
- $qast[0].push(buildsub($<nibbler>[0].ast));
+ $qast[0].push(buildsub($<nibbler>[0].ast, :anon(1)));
}
}
make $qast;
@@ -409,7 +409,7 @@ class QRegex::P6Regex::Actions is HLL::Actions {
$ast;
}
- our sub buildsub($qast, $block = PAST::Block.new(:blocktype<method>)) {
+ our sub buildsub($qast, $block = PAST::Block.new(:blocktype<method>), :$anon) {
my $hashpast := PAST::Op.new( :pasttype<hash> );
for capnames($qast, 0) {
if $_.key gt '' {
@@ -439,7 +439,9 @@ class QRegex::P6Regex::Actions is HLL::Actions {
$qast := QAST::Regex.new( :rxtype<concat>,
QAST::Regex.new( :rxtype<scan> ),
$qast,
- QAST::Regex.new( :rxtype<pass>, :name(%*RX<name>) ));
+ ($anon ??
+ QAST::Regex.new( :rxtype<pass> ) !!
+ QAST::Regex.new( :rxtype<pass>, :name(%*RX<name>) )));
$block.push($initpast);
$block.push(PAST::QAST.new($qast));
$block;
Please sign in to comment.
Something went wrong with that request. Please try again.