aboutsummaryrefslogtreecommitdiffstats
path: root/test-files
diff options
context:
space:
mode:
Diffstat (limited to 'test-files')
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/alive-code/for-for-break-end-alive25
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/dead-code/for-break-dead14
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/dead-code/for-if-continue-else-continue-end-dead25
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/dead-code/function-for-return-end-dead20
-rw-r--r--test-files/mds-kbdc/eliminate-dead-code/dead-code/macro-for-return-end-dead20
5 files changed, 104 insertions, 0 deletions
diff --git a/test-files/mds-kbdc/eliminate-dead-code/alive-code/for-for-break-end-alive b/test-files/mds-kbdc/eliminate-dead-code/alive-code/for-for-break-end-alive
new file mode 100644
index 0000000..6523352
--- /dev/null
+++ b/test-files/mds-kbdc/eliminate-dead-code/alive-code/for-for-break-end-alive
@@ -0,0 +1,25 @@
+for 1 to 2 as \1
+ for 1 to 2 as \2
+ break
+ end for
+ <alive> : "code"
+end for
+
+# (for (@ 1 0-3) ‘1’ ‘2’ (.variable ‘\1’)
+# (.inner
+# (for (@ 2 2-5) ‘1’ ‘2’ (.variable ‘\2’)
+# (.inner
+# (break (@ 3 4-9))
+# )
+# )
+# (map (@ 5 2-2)
+# (.sequence
+# (keys (@ 5 2-9) ‘<alive>’)
+# )
+# (.result
+# (string (@ 5 12-18) ‘"code"’)
+# )
+# )
+# )
+# )
+
diff --git a/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-break-dead b/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-break-dead
new file mode 100644
index 0000000..f8037a3
--- /dev/null
+++ b/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-break-dead
@@ -0,0 +1,14 @@
+for 1 to 2 as \1
+ break
+ break
+end for
+
+# (for (@ 1 0-3) ‘1’ ‘2’ (.variable ‘\1’)
+# (.inner
+# (break (@ 2 2-7))
+# )
+# )
+# :3:2–7: warning: statement is unreachable
+# break
+# ^^^^^
+
diff --git a/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-if-continue-else-continue-end-dead b/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-if-continue-else-continue-end-dead
new file mode 100644
index 0000000..108c7b0
--- /dev/null
+++ b/test-files/mds-kbdc/eliminate-dead-code/dead-code/for-if-continue-else-continue-end-dead
@@ -0,0 +1,25 @@
+for 1 to 2 as \1
+ if 1
+ continue
+ else
+ continue
+ end if
+ <dead code> : "dead code"
+end for
+
+# (for (@ 1 0-3) ‘1’ ‘2’ (.variable ‘\1’)
+# (.inner
+# (if (@ 2 2-4) ‘1’
+# (.inner
+# (continue (@ 3 4-12))
+# )
+# (.otherwise
+# (continue (@ 5 4-12))
+# )
+# )
+# )
+# )
+# :7:2–2: warning: statement is unreachable
+# <dead code> : "dead code"
+#
+
diff --git a/test-files/mds-kbdc/eliminate-dead-code/dead-code/function-for-return-end-dead b/test-files/mds-kbdc/eliminate-dead-code/dead-code/function-for-return-end-dead
new file mode 100644
index 0000000..39fb763
--- /dev/null
+++ b/test-files/mds-kbdc/eliminate-dead-code/dead-code/function-for-return-end-dead
@@ -0,0 +1,20 @@
+function f/0
+ for 1 to 1 as \1
+ return
+ end for
+ "dead code"
+end function
+
+# (function (@ 1 0-8) ‘f/0’
+# (.inner
+# (for (@ 2 2-5) ‘1’ ‘1’ (.variable ‘\1’)
+# (.inner
+# (return (@ 3 4-10))
+# )
+# )
+# )
+# )
+# :5:2–2: warning: statement is unreachable
+# "dead code"
+#
+
diff --git a/test-files/mds-kbdc/eliminate-dead-code/dead-code/macro-for-return-end-dead b/test-files/mds-kbdc/eliminate-dead-code/dead-code/macro-for-return-end-dead
new file mode 100644
index 0000000..eb8fdaa
--- /dev/null
+++ b/test-files/mds-kbdc/eliminate-dead-code/dead-code/macro-for-return-end-dead
@@ -0,0 +1,20 @@
+macro m/0
+ for 1 to 1 as \1
+ return
+ end for
+ <dead code> : "dead code"
+end macro
+
+# (macro (@ 1 0-5) ‘m/0’
+# (.inner
+# (for (@ 2 2-5) ‘1’ ‘1’ (.variable ‘\1’)
+# (.inner
+# (return (@ 3 4-10))
+# )
+# )
+# )
+# )
+# :5:2–2: warning: statement is unreachable
+# <dead code> : "dead code"
+#
+