1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-10 21:30:04 +00:00

Undo lambda funcs when RVALUE only statements

This commit is contained in:
David Schmenk 2017-08-02 20:42:18 -07:00
parent 4910f18661
commit 9eb0e7286a

View File

@ -743,6 +743,7 @@ t_opseq *parse_set(t_opseq *codeseq)
char *setptr = tokenstr; char *setptr = tokenstr;
int lparms = 0, rparms = 0; int lparms = 0, rparms = 0;
int i; int i;
int lambda_set = lambda_cnt;
t_opseq *setseq[16], *rseq = NULL; t_opseq *setseq[16], *rseq = NULL;
while ((setseq[lparms] = parse_value(NULL, LVALUE, NULL))) while ((setseq[lparms] = parse_value(NULL, LVALUE, NULL)))
@ -757,6 +758,12 @@ t_opseq *parse_set(t_opseq *codeseq)
scan_rewind(tokenstr); scan_rewind(tokenstr);
while (lparms--) while (lparms--)
release_seq(setseq[lparms]); release_seq(setseq[lparms]);
while (lambda_cnt > lambda_set)
{
lambda_cnt--;
lambda_num--;
release_seq(lambda_seq[lambda_cnt]);
}
return (NULL); return (NULL);
} }
rseq = parse_list(NULL, &rparms); rseq = parse_list(NULL, &rparms);
@ -1523,6 +1530,9 @@ int parse_lambda(void)
lambda_cparams[lambda_cnt] = cfnparms; lambda_cparams[lambda_cnt] = cfnparms;
lambda_tag[lambda_cnt] = func_tag; lambda_tag[lambda_cnt] = func_tag;
sprintf(lambda_id[lambda_cnt], "_LAMBDA%04d", lambda_num++); sprintf(lambda_id[lambda_cnt], "_LAMBDA%04d", lambda_num++);
if (idglobal_lookup(lambda_id[lambda_cnt], strlen(lambda_id[lambda_cnt])) >= 0)
idfunc_set(lambda_id[lambda_cnt], strlen(lambda_id[lambda_cnt]), DEF_TYPE | funcparms_type(cfnparms), func_tag); // Override any predef type & tag
else
idfunc_add(lambda_id[lambda_cnt], strlen(lambda_id[lambda_cnt]), DEF_TYPE | funcparms_type(cfnparms), func_tag); idfunc_add(lambda_id[lambda_cnt], strlen(lambda_id[lambda_cnt]), DEF_TYPE | funcparms_type(cfnparms), func_tag);
lambda_cnt++; lambda_cnt++;
idlocal_restore(); idlocal_restore();