summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-02-23 01:21:15 -0500
committerKyle Gunger <kgunger12@gmail.com>2024-02-23 01:21:15 -0500
commitbb5f0f1d0906adae57f9673cb48c0fcedf1d11d4 (patch)
tree224a02514d9b787d89d6a6e506a66385244727d0
parent95d811be4825498cbcdc8bb0f26cad909bd8b58e (diff)
only eval when value
-rw-r--r--compiler.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler.c b/compiler.c
index 82b0131..068c65f 100644
--- a/compiler.c
+++ b/compiler.c
@@ -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)