Skip to content

Commit

Permalink
Check for $x ~~ .foo is syntactic and should thus be done on the pars…
Browse files Browse the repository at this point in the history
…e three, not the PAST tree (pmichaud++ for input).
  • Loading branch information
jnthn committed Feb 13, 2009
1 parent 7175fd0 commit a0a3902
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/parser/actions.pm
Expand Up @@ -217,6 +217,7 @@ method when_statement($/) {
my $match_past := process_smartmatch(
PAST::Var.new( :name('$_') ),
$( $<EXPR> ),
$<EXPR><expr>
);

# Use the smartmatch result as the condition.
Expand Down Expand Up @@ -2510,7 +2511,7 @@ method EXPR($/, $key) {
# rest fall through to a call to .ACCEPTS.
my $lhs := $( $/[0] );
my $rhs := $( $/[1] );
make process_smartmatch($lhs, $rhs);
make process_smartmatch($lhs, $rhs, $/[1]);
}
elsif ~$type eq 'prefix:|' {
# Need to make it flatten the argument.
Expand Down Expand Up @@ -3004,8 +3005,8 @@ sub transform_to_multi($past) {

# Hanldes syntactic forms of smart-matching (factored out here since it's used
# by infix:~~ and the when statement.
sub process_smartmatch($lhs, $rhs) {
if $rhs.isa(PAST::Stmts) && $rhs<invocant_holder> {
sub process_smartmatch($lhs, $rhs, $rhs_pt) {
if $rhs_pt<noun><dotty> {
# Method truth - just call RHS.
$rhs<invocant_holder>[0] := $lhs;
return PAST::Op.new(
Expand Down

0 comments on commit a0a3902

Please sign in to comment.