aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorOr Brostovski <[email protected]>2010-08-31 06:07:32 +0300
committerGraydon Hoare <[email protected]>2010-09-30 13:45:57 -0700
commit4a3404803b6c6de079a590a4bc96313d9a68f164 (patch)
tree705b0f8710b408c49e3a609bb7ddfc6bdb4a68b3 /src/test
parentClosed issue 154 - prevents compiler from compiliing a line to zero statements (diff)
downloadrust-4a3404803b6c6de079a590a4bc96313d9a68f164.tar.xz
rust-4a3404803b6c6de079a590a4bc96313d9a68f164.zip
implemented break for while-loop case
ast.ml - added break and cont statements item.ml - added break and cont statements lexer.mll - added break and cont statements token.ml - added break and cont statements trans.ml - implemented the break statement for the while-loop case - replaced hash table accesses with get_stmt_depth where needed type.ml = added break and cont statements typestate.ml - implemented the break statement for the while-loop case - added shorthand filter_live_block_slots walk.ml - added break and cont statements while-with-break.rs - code for testing while loops
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/while-with-break.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/run-pass/while-with-break.rs b/src/test/run-pass/while-with-break.rs
new file mode 100644
index 00000000..0e27f252
--- /dev/null
+++ b/src/test/run-pass/while-with-break.rs
@@ -0,0 +1,15 @@
+// -*- rust -*-
+
+fn main() {
+ let int i = 90;
+ while (i < 100) {
+ log i;
+ i = i + 1;
+ if (i == 95) {
+ let vec[int] v = vec(1,2,3,4,5); // we check that it is freed by break
+ log "breaking";
+ break;
+ }
+ }
+ check(i == 95);
+}