From 4884806bca49e2ff8646ae2212d0f782ec56732f Mon Sep 17 00:00:00 2001 From: Moritz Lenz Date: Mon, 26 Jul 2010 11:24:48 +0200 Subject: [PATCH] turn s/// into a call This means it now works everywhere, not only on the RHS of smart-matching. --- src/Perl6/Actions.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm index b4f2d3b9f5a..0ee79b7b1c1 100644 --- a/src/Perl6/Actions.pm +++ b/src/Perl6/Actions.pm @@ -2710,11 +2710,9 @@ method quote:sym($/) { my $closure := block_closure($closure_ast, 'Block', 0); # Make a Substitution. - $regex.named('matcher'); - $closure.named('replacer'); my $past := PAST::Op.new( - :pasttype('callmethod'), :name('new'), - PAST::Var.new( :name('Substitution'), :scope('package') ), + :pasttype('callmethod'), :name('subst'), + PAST::Var.new( :name('$_'), :scope('lexical') ), $regex, $closure ); for $ { @@ -2723,6 +2721,14 @@ method quote:sym($/) { } $past.push($_.ast); } + + $past := PAST::Op.new( + :pasttype('call'), + :name('&infix:<=>'), + PAST::Var.new(:name('$_'), :scope('lexical')), + $past + ); + make $past; }