fixed bugs in compile_symbol() and read_vlist()

This commit is contained in:
hyung-hwan 2021-01-25 14:24:00 +00:00
parent 581b13aedd
commit fbbdb6188e
2 changed files with 7 additions and 10 deletions

View File

@ -1733,7 +1733,7 @@ static HCL_INLINE int compile_symbol (hcl_t* hcl, hcl_cnode_t* obj)
if (HCL_CNODE_SYMBOL_SYNCODE(obj)) if (HCL_CNODE_SYMBOL_SYNCODE(obj))
{ {
hcl_setsynerrbfmt (hcl, HCL_SYNERR_BANNEDVARNAME, HCL_CNODE_GET_LOC(obj), HCL_CNODE_GET_TOK(obj), "special symbol not to be used as a variable name - %.*js"); hcl_setsynerrbfmt (hcl, HCL_SYNERR_BANNEDVARNAME, HCL_CNODE_GET_LOC(obj), HCL_CNODE_GET_TOK(obj), "special symbol not to be used as a variable name");
return -1; return -1;
} }

View File

@ -1643,18 +1643,15 @@ static hcl_cnode_t* read_vlist (hcl_t* hcl)
{ {
hcl_cnode_t* sym, * cons; hcl_cnode_t* sym, * cons;
sym = hcl_makecnodesymbol(hcl, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); if (hcl_getsyncodebyoocs_noseterr(hcl, TOKEN_NAME(hcl)) > 0)
if (HCL_UNLIKELY(!sym)) goto oops;
#if 0
if (HCL_OBJ_GET_FLAGS_SYNCODE(sym) || HCL_OBJ_GET_FLAGS_KERNEL(sym))
{ {
hcl_setsynerrbfmt (hcl, HCL_SYNERR_BANNEDVARNAME, HCL_NULL, HCL_NULL, hcl_setsynerrbfmt (hcl, HCL_SYNERR_BANNEDVARNAME, TOKEN_LOC(hcl), TOKEN_NAME(hcl),
"special symbol not to be declared as a variable - %O", sym); /* TOOD: error location */ "special symbol not to be declared as a variable");
goto oops; goto oops;
} }
/* TODO: exclude special symbols.... or do the above check in the compiler code?? */
#endif sym = hcl_makecnodesymbol(hcl, TOKEN_LOC(hcl), TOKEN_NAME(hcl));
if (HCL_UNLIKELY(!sym)) goto oops;
cons = hcl_makecnodecons(hcl, HCL_CNODE_GET_LOC(sym), sym, HCL_NULL); cons = hcl_makecnodecons(hcl, HCL_CNODE_GET_LOC(sym), sym, HCL_NULL);
if (HCL_UNLIKELY(!cons)) if (HCL_UNLIKELY(!cons))