summaryrefslogtreecommitdiff
path: root/test.toc
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-03-11 15:57:42 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2020-03-11 15:57:42 -0400
commit0b16c903741e2f6178c07531ab13026c3de6ce5b (patch)
tree40e8b20204618edc705638cc36620df88a859c7d /test.toc
parent4cdee65cadb4f6e714fe30945ed9080e191618f6 (diff)
prevent varargs[i] from being an lvalue
Diffstat (limited to 'test.toc')
-rw-r--r--test.toc14
1 files changed, 7 insertions, 7 deletions
diff --git a/test.toc b/test.toc
index 53efe0d..c12a1f7 100644
--- a/test.toc
+++ b/test.toc
@@ -1,19 +1,19 @@
#include "std/io.toc";
-s ::= struct(x::..) {
-};
-
-f ::= fn(x : ..) int {
+g ::= fn(x : ..) int {
total := 0;
- for _, i := x {
- total += i * (x[0] as int);
+ for e, i := x {
+ total += i * (e as int);
}
total
};
+f ::= fn(x : ..) int {
+ g(x)
+};
main ::= fn() {
- puti(f(5));
+ puti(g(5));
puti(f(5,6));