Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix +=-based meta operators (pmichaud++)
  • Loading branch information
sorear committed Jul 7, 2011
1 parent 9ba8284 commit 0b2219d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/niecza
Expand Up @@ -62,6 +62,23 @@ augment grammar STD::P6 {
}
}

augment class Sig::Parameter {
method simple($n) { self.new(name => $n, slot => $n, :rwtrans) }
}

augment class Operator::CompoundAssign {
method with_args($/, *@rest) {
my $left = shift @rest;
if $left.^isa(::Op::Lexical) {
my $nlft = ::Op::Lexical.new(|node($/), name => $left.name);
mkcall($/, '&infix:<=>', $left, $.base.with_args($/, $nlft, @rest));
} else {
mklet($left, -> $ll {
mkcall($/, '&infix:<=>', $ll, $.base.with_args($/, $ll, @rest)) });
}
}
}

class Op::DoOnceLoop is Op {
has Op $.body = die "DoOnceLoop.body required";
method zyg() { $!body }
Expand Down
1 change: 1 addition & 0 deletions t/spectest.data
Expand Up @@ -76,6 +76,7 @@ S04-statements/loop.t
S04-statements/map-and-sort-in-for.t
S04-statements/next.t
S04-statements/no-implicit-block.t
S04-statements/redo.t
S04-statements/repeat.t
S04-statements/return.t
S04-statements/unless.t
Expand Down

0 comments on commit 0b2219d

Please sign in to comment.