reader improvement to filter out binop from a tuple
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-07-15 01:02:07 +09:00
parent 7754d7c7e9
commit 57d9668110
4 changed files with 21 additions and 13 deletions

View File

@ -1429,7 +1429,12 @@ static int collect_vardcl_for_class (hcl_t* hcl, hcl_cnode_t* obj, hcl_cnode_t**
if (HCL_CNODE_IS_CONS_CONCODED(var, HCL_CONCODE_TUPLE)) /* [ ... ] */
{
if (enclosed) goto synerr_varname;
if (enclosed)
{
synerr_varname:
hcl_setsynerrbfmt (hcl, HCL_SYNERR_VARNAME, HCL_CNODE_GET_LOC(var), HCL_CNODE_GET_TOK(var), "not variable name");
return -1;
}
enclosed = 1;
dcl_saved = dcl;
dcl = var;
@ -1442,12 +1447,9 @@ static int collect_vardcl_for_class (hcl_t* hcl, hcl_cnode_t* obj, hcl_cnode_t**
goto next;
}
if (!HCL_CNODE_IS_SYMBOL_PLAIN(var))
{
synerr_varname:
hcl_setsynerrbfmt (hcl, HCL_SYNERR_VARNAME, HCL_CNODE_GET_LOC(var), HCL_CNODE_GET_TOK(var), "not variable name");
return -1;
}
/* this check isn't needed as the reader guarantees this condition.
if (!HCL_CNODE_IS_SYMBOL_PLAIN(var) || HCL_CNODE_IS_SYMBOL_PLAIN_BINOP(var)) goto synerr_varname;*/
HCL_ASSERT (hcl, HCL_CNODE_IS_SYMBOL_PLAIN(var) && !HCL_CNODE_IS_SYMBOL_PLAIN_BINOP(var));
checkpoint = hcl->c->tv.s.len;
n = add_temporary_variable(hcl, HCL_CNODE_GET_TOK(var), tv_slen_saved);