From: Michael D. Lowis Date: Mon, 7 Jun 2021 16:19:16 +0000 (-0400) Subject: fixed up function calls X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=d774ef5aacd9e1a0ba7beeabb5d95b632d950d83;p=proto%2Fobnc.git fixed up function calls --- diff --git a/cerise/src/grammar.c b/cerise/src/grammar.c index f062596..7e891c8 100644 --- a/cerise/src/grammar.c +++ b/cerise/src/grammar.c @@ -190,7 +190,8 @@ RULE(factor) if (accept(p, '(')) { Symbol* proc = symbol_get(p, item->imm.s, SYM_PROC); - Symbol* args = proc->desc; + item->type = proc->type->base; + Field* args = proc->type->fields; Item arglist = {0}; Item** currarg = &(arglist.next); while (args && !matches(p, ')')) @@ -208,7 +209,6 @@ RULE(factor) expect(p, ','); } } - if (args) { error(p, "too few arguments to function '%s'", proc->name); diff --git a/cerise/tests/Module.m b/cerise/tests/Module.m index d9ddecd..eeead13 100644 --- a/cerise/tests/Module.m +++ b/cerise/tests/Module.m @@ -48,6 +48,11 @@ begin return z1; end +procedure Bar(a : Int) : Int +begin + return a; +end + begin h[1].i = 42; @@ -130,6 +135,6 @@ begin # g[c] = 42; # e[0][9] = 42; - + c = Bar(42); end