X-Git-Url: https://ocean-lang.org/code/?p=ocean;a=blobdiff_plain;f=csrc%2Foceani.mdc;h=fabfe188c07ebd5bc9abdca9dd492aad34041de2;hp=c89ecafc6c33890f838890eceb91b815e07575f3;hb=6a7ef05f3986dd8127b8c3bfaeeceb514a8beaa4;hpb=499033323e79fc5d2b757c2055ad5bd0f55bc7f3 diff --git a/csrc/oceani.mdc b/csrc/oceani.mdc index c89ecaf..fabfe18 100644 --- a/csrc/oceani.mdc +++ b/csrc/oceani.mdc @@ -2340,19 +2340,22 @@ has a type which includes the set of parameters and the return value. As yet these types cannot be declared separately from the function itself. -The parameters can be specified either in parentheses as a list, such as +The parameters can be specified either in parentheses as a ';' separated +list, such as ##### Example: function 1 - func main(av:[ac::number]string) + func main(av:[ac::number]string; env:[envc::number]string) code block -or as an indented list of one parameter per line +or as an indented list of one parameter per line (though each line can +be a ';' separated list) ##### Example: function 2 func main argv:[argc::number]string + env:[envc::number]string do code block @@ -2479,12 +2482,21 @@ further detailed when Expression Lists are introduced. $*binode - Args -> ${ $0 = NULL; }$ + Args -> ArgsLine NEWLINE ${ $0 = $left; + *bp = $ ${ $0 = NULL; }$ | Varlist ${ $0 = $<1; }$ | Varlist ; ${ $0 = $<1; }$ - | Varlist NEWLINE ${ $0 = $<1; }$ - Varlist -> Varlist ; ArgDecl ${ // UNTESTED + Varlist -> Varlist ; ArgDecl ${ $0 = new(binode); $0->op = List; $0->left = $ func FuncName ( OpenScope Args ) Block Newlines ${ + DeclareFunction -> func FuncName ( OpenScope ArgsLine ) Block Newlines ${ $0 = declare_function(c, $in_scope; ok && v; v = v->in_scope) { + int all_ok = 1; + for (v = c->in_scope; v; v = v->in_scope) { struct value *val; + int ok = 1; if (v->depth != 0 || !v->type || !v->type->check_args) continue; val = var_value(c, v); @@ -4783,9 +4796,11 @@ analysis is a bit more interesting at this level. if (ok) /* Make sure everything is still consistent */ propagate_types(val->function, c, &ok, Tnone, 0); + if (!ok) + all_ok = 0; v->type->function.local_size = scope_finalize(c); } - return ok; + return all_ok; } static int analyse_main(struct type *type, struct parse_context *c)