Skip to content

Commit

Permalink
turn s/// into a call
Browse files Browse the repository at this point in the history
This means it now works everywhere, not only on the RHS of smart-matching.
  • Loading branch information
moritz committed Jul 26, 2010
1 parent 807748a commit 4884806
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Perl6/Actions.pm
Expand Up @@ -2710,11 +2710,9 @@ method quote:sym<s>($/) {
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 $<quotepair> {
Expand All @@ -2723,6 +2721,14 @@ method quote:sym<s>($/) {
}
$past.push($_.ast);
}

$past := PAST::Op.new(
:pasttype('call'),
:name('&infix:<=>'),
PAST::Var.new(:name('$_'), :scope('lexical')),
$past
);

make $past;
}

Expand Down

0 comments on commit 4884806

Please sign in to comment.