diff --git a/src/samplesrc/test.pla b/src/samplesrc/test.pla index e35a03d..0de4a05 100755 --- a/src/samplesrc/test.pla +++ b/src/samplesrc/test.pla @@ -121,6 +121,11 @@ export def main(range) lambda = &(x,y) x * y puti(lambda(2,3));putln end + +def dummy(zz)#0 + puts("dummy func"); putln +end + puti(array[0]);putc(' ') puti(array[1]);putc(' ') puti(array[2]);putc(' ') diff --git a/src/toolsrc/parse.c b/src/toolsrc/parse.c index 781af06..548e5f2 100755 --- a/src/toolsrc/parse.c +++ b/src/toolsrc/parse.c @@ -1485,7 +1485,6 @@ int parse_lambda(void) * Parse parameters and return value count */ cfnparms = 0; - func_tag = tag_new(DEF_TYPE); if (scan() == OPEN_PAREN_TOKEN) { do @@ -1527,13 +1526,19 @@ int parse_lambda(void) lambda_seq[lambda_cnt] = parse_expr(NULL, NULL); scan_rewind(tokenstr); } - lambda_cparams[lambda_cnt] = cfnparms; - lambda_tag[lambda_cnt] = func_tag; sprintf(lambda_id[lambda_cnt], "_LAMBDA%04d", lambda_num++); if (idglobal_lookup(lambda_id[lambda_cnt], strlen(lambda_id[lambda_cnt])) >= 0) + { + func_tag = lambda_tag[lambda_cnt]; idfunc_set(lambda_id[lambda_cnt], strlen(lambda_id[lambda_cnt]), DEF_TYPE | funcparms_type(cfnparms), func_tag); // Override any predef type & tag + } else + { + func_tag = tag_new(DEF_TYPE); + lambda_tag[lambda_cnt] = func_tag; + lambda_cparams[lambda_cnt] = cfnparms; idfunc_add(lambda_id[lambda_cnt], strlen(lambda_id[lambda_cnt]), DEF_TYPE | funcparms_type(cfnparms), func_tag); + } lambda_cnt++; idlocal_restore(); return (func_tag);