summary refs log tree commit diff stats
path: root/tests/accept/compile/tlinearscanend.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-03-23 01:09:52 +0100
committerAraq <rumpf_a@web.de>2011-03-23 01:09:52 +0100
commit5b789f2da8e57ea2adf0c088f5e41fd7a71fe89b (patch)
tree81f2f23d48d56ef7b106d24982231d99809a6def /tests/accept/compile/tlinearscanend.nim
parent8d734244b14e09c97267432468ac20fcf8ff82eb (diff)
downloadNim-5b789f2da8e57ea2adf0c088f5e41fd7a71fe89b.tar.gz
bugfixes; field discriminant checks; linearScanEnd, unroll, shallow pragmas
Diffstat (limited to 'tests/accept/compile/tlinearscanend.nim')
-rwxr-xr-xtests/accept/compile/tlinearscanend.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/accept/compile/tlinearscanend.nim b/tests/accept/compile/tlinearscanend.nim
new file mode 100755
index 000000000..15fd0c70a
--- /dev/null
+++ b/tests/accept/compile/tlinearscanend.nim
@@ -0,0 +1,24 @@
+
+import strutils
+
+var x = 343
+
+case stdin.readline.parseInt
+of 0: 
+  echo "most common case"
+of 1: 
+  {.linearScanEnd.}
+  echo "second most common case"
+of 2: echo "unlikely: use branch table"
+else: 
+  echo "unlikely too: use branch table"
+
+
+case x
+of 23: echo "23"
+of 343: echo "343"
+of 21: echo "21"
+else: 
+  {.linearScanEnd.}
+  echo "default"
+