diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-03-26 16:58:06 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-03-26 16:58:06 -0400 |
commit | 47e23274dc0fb78389e396fb41391ea089bcea66 (patch) | |
tree | 19332853ff527786aeca4da742473c7f9c6a02fe | |
parent | 0e9ecb75d6893425b845dab932218d56c814ab4a (diff) |
Better error message for missing parameters
-rw-r--r-- | compiler.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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 |