aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-11-24 02:44:03 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-11-24 02:44:03 -0500
commit0c22358cc1cccacb9a30929fbbc990ba9d82b6b3 (patch)
tree68f861f84eaa471832ddb978e876d3097de6be8a /test
parenta2257e4b81764f8603a39b74eae3622651ec7d6b (diff)
downloadzig-0c22358cc1cccacb9a30929fbbc990ba9d82b6b3.tar.gz
zig-0c22358cc1cccacb9a30929fbbc990ba9d82b6b3.zip
IR: generating a switch statement
Diffstat (limited to 'test')
-rw-r--r--test/self_hosted2.zig14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/self_hosted2.zig b/test/self_hosted2.zig
index cafec36d1c..aae599c572 100644
--- a/test/self_hosted2.zig
+++ b/test/self_hosted2.zig
@@ -12,9 +12,23 @@ export fn disabledExternFn() {
@setFnVisible(this, false);
}
+fn inlinedLoop() {
+ inline var i = 0;
+ inline var sum = 0;
+ inline while (i <= 5; i += 1)
+ sum += i;
+ assert(sum == 15);
+}
+
+fn assert(ok: bool) {
+ if (!ok)
+ @unreachable();
+}
+
fn runAllTests() {
emptyFunctionWithComments();
disabledExternFn();
+ inlinedLoop();
}
export nakedcc fn _start() -> unreachable {