diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-02-23 01:21:15 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-02-23 01:21:15 -0500 |
commit | bb5f0f1d0906adae57f9673cb48c0fcedf1d11d4 (patch) | |
tree | 224a02514d9b787d89d6a6e506a66385244727d0 | |
parent | 95d811be4825498cbcdc8bb0f26cad909bd8b58e (diff) |
only eval when value
-rw-r--r-- | compiler.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -3889,16 +3889,20 @@ void p2_compile_def(Scope *s, CompData *out, Vector *tokens, size_t *pos) { *pos = tnsl_find_closing(tokens, *pos); } else if (tok_str_eq(t, ",")) { // Split def - Variable store = _eval(s, out, tokens, start, *pos); - var_end(&store); + if(*pos - start > 1) { + Variable store = _eval(s, out, tokens, start, *pos); + var_end(&store); + } start = *pos + 1; } *pos += 1; } var_end(&type); - Variable store = _eval(s, out, tokens, start, *pos); - var_end(&store); + if (*pos - start > 1) { + Variable store = _eval(s, out, tokens, start, *pos); + var_end(&store); + } } // TODO (depends on top-level defs working) |