From fbbdb6188efb6422b4807c6c226f0b5b7c25f6ee Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 25 Jan 2021 14:24:00 +0000 Subject: [PATCH] fixed bugs in compile_symbol() and read_vlist() --- lib/comp2.c | 2 +- lib/read2.c | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/comp2.c b/lib/comp2.c index 3f36bc4..2d677da 100644 --- a/lib/comp2.c +++ b/lib/comp2.c @@ -1733,7 +1733,7 @@ static HCL_INLINE int compile_symbol (hcl_t* hcl, hcl_cnode_t* 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; } diff --git a/lib/read2.c b/lib/read2.c index dc63f39..fdd711f 100644 --- a/lib/read2.c +++ b/lib/read2.c @@ -1643,18 +1643,15 @@ static hcl_cnode_t* read_vlist (hcl_t* hcl) { hcl_cnode_t* sym, * cons; - sym = hcl_makecnodesymbol(hcl, TOKEN_LOC(hcl), TOKEN_NAME(hcl)); - if (HCL_UNLIKELY(!sym)) goto oops; - -#if 0 - if (HCL_OBJ_GET_FLAGS_SYNCODE(sym) || HCL_OBJ_GET_FLAGS_KERNEL(sym)) + if (hcl_getsyncodebyoocs_noseterr(hcl, TOKEN_NAME(hcl)) > 0) { - hcl_setsynerrbfmt (hcl, HCL_SYNERR_BANNEDVARNAME, HCL_NULL, HCL_NULL, - "special symbol not to be declared as a variable - %O", sym); /* TOOD: error location */ + hcl_setsynerrbfmt (hcl, HCL_SYNERR_BANNEDVARNAME, TOKEN_LOC(hcl), TOKEN_NAME(hcl), + "special symbol not to be declared as a variable"); 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); if (HCL_UNLIKELY(!cons))