Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Implement 'repeat'

  • Loading branch information...
commit 2426a6c8eb165f1dccf637d0297201344475da8c 1 parent 7b248ac
@sorear authored
Showing with 8 additions and 0 deletions.
  1. +7 −0 src/niecza
  2. +1 −0  t/run_spectests
View
7 src/niecza
@@ -248,6 +248,13 @@ method statement_control:loop ($/) {
make ::Op::GeneralLoop.new(|node($/), :$body, :$init, :$cond, :$step);
}
+method statement_control:repeat ($/) {
+ my $until = $<wu> eq 'until';
+ my $check = $<xblock> ?? $<xblock>.ast[0] !! $<EXPR>.ast;
+ my $body = self.block_to_immediate($/, 'loop',
+ $<xblock> ?? $<xblock>.ast[1] !! $<pblock>.ast);
+ make ::Op::WhileLoop.new(|node($/), :$check, :$until, :$body, :once);
+}
}
augment class CgOp {
View
1  t/run_spectests
@@ -32,6 +32,7 @@ prove -e 't/fudgeandrun' \
../roast/S04-statements/map-and-sort-in-for.t \
../roast/S04-statements/next.t \
../roast/S04-statements/no-implicit-block.t \
+ ../roast/S04-statements/repeat.t \
../roast/S04-statements/unless.t \
../roast/S04-statements/until.t \
../roast/S04-statements/while.t \
Please sign in to comment.
Something went wrong with that request. Please try again.