diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-11 15:57:42 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-03-11 15:57:42 -0400 |
commit | 0b16c903741e2f6178c07531ab13026c3de6ce5b (patch) | |
tree | 40e8b20204618edc705638cc36620df88a859c7d /test.toc | |
parent | 4cdee65cadb4f6e714fe30945ed9080e191618f6 (diff) |
prevent varargs[i] from being an lvalue
Diffstat (limited to 'test.toc')
-rw-r--r-- | test.toc | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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)); |