Permalink
Browse files

Fix +=-based meta operators (pmichaud++)

  • Loading branch information...
sorear committed Jul 7, 2011
1 parent 9ba8284 commit 0b2219d9128f2a51f38a7ad8a59f612f9dbd9706
Showing with 18 additions and 0 deletions.
  1. +17 −0 src/niecza
  2. +1 −0 t/spectest.data
View
@@ -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 }
View
@@ -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

0 comments on commit 0b2219d

Please sign in to comment.