Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[v6] Fix whatever-star currying
  • Loading branch information
sorear committed Jan 12, 2011
1 parent a21bc67 commit 6e17857
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions v6/harness
Expand Up @@ -180,6 +180,24 @@ sub mkcall($/, $name, *@positionals) {
::Op::CallSub.new(|node($/),
invocant => ::Op::Lexical.new(|node($/), :$name), :@positionals);
}
my %_nowhatever = (map { ($_ => True) }, ('&infix:<,>', '&infix:<..>',
'&infix:<...>', '&infix:<=>', '&infix:<xx>'));
method whatever_precheck($op, *@args) {
return ([], @args) if %_nowhatever{$op};
my @vars;
my @args_ = @args;
for @args_ -> $a is rw {
die "invalid undef here" if !$a;
if $a.^isa(::Op::Whatever) {
push @vars, $a.slot;
$a = ::Op::Lexical.new(name => $a.slot);
} elsif $a.^isa(::Op::WhateverCode) {
push @vars, @( $a.vars );
$a = $a.ops;
}
}
$( @vars ), @args_;
}
my %loose2tight = (
'&&' => '&&', '||' => '||', '//' => '//', 'andthen' => 'andthen',
'orelse' => '//', 'and' => '&&', 'or' => '||',
Expand Down

0 comments on commit 6e17857

Please sign in to comment.