summaryrefslogtreecommitdiff
path: root/compiler.c
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-03-26 16:58:06 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-03-26 16:58:06 -0400
commit47e23274dc0fb78389e396fb41391ea089bcea66 (patch)
tree19332853ff527786aeca4da742473c7f9c6a02fe /compiler.c
parent0e9ecb75d6893425b845dab932218d56c814ab4a (diff)
Better error message for missing parameters
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler.c b/compiler.c
index 643fd35..2729484 100644
--- a/compiler.c
+++ b/compiler.c
@@ -4535,6 +4535,15 @@ Variable _eval_call(Scope *s, CompData *data, Vector *tokens, Function *f, Varia
// create tmp var
Variable set = scope_mk_stmp(s, data, cur);
Variable from = _eval(s, data, tokens, pstart, pend);
+
+ if (from.name == NULL) {
+ Token *p = vect_get(tokens, pstart);
+ printf("ERROR: Expected value for parameter \"%s\" in call to function \"%s\" (%d:%d)\n", cur->name, f->name, p->line, p->col);
+ p2_error = true;
+ i = f->inputs.count;
+ break;
+ }
+
// eval and set
if (_var_ptr_type(&set) == PTYPE_REF)
var_op_pure_set(data, &set, &from);
@@ -4591,6 +4600,15 @@ Variable _eval_call(Scope *s, CompData *data, Vector *tokens, Function *f, Varia
Variable set = scope_mk_stmp(s, data, cur);
// eval and set
Variable from = _eval(s, data, tokens, pstart, pend);
+
+ if (from.name == NULL) {
+ Token *p = vect_get(tokens, pstart);
+ printf("ERROR: Expected value for parameter \"%s\" in call to function \"%s\" (%d:%d)\n", cur->name, f->name, p->line, p->col);
+ p2_error = true;
+ i = f->inputs.count;
+ break;
+ }
+
if (_var_ptr_type(&set) == PTYPE_REF)
var_op_pure_set(data, &set, &from);
else