From 708060fdad855648f2984d1969157c497d30d944 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 30 Mar 2020 19:55:11 +0200 Subject: [PATCH] update --- ast | 2 +- include/specialid.h | 2 +- src/lib/opfunc.c | 12 +++--------- src/parse/scan1.c | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ast b/ast index c16ad008..20493d2b 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit c16ad0087304f84595aa4f901f2d71465e391192 +Subproject commit 20493d2bc523d9c28f3b0ce7271bfe6c788b16ad diff --git a/include/specialid.h b/include/specialid.h index a2a81a77..4a1daee9 100644 --- a/include/specialid.h +++ b/include/specialid.h @@ -20,7 +20,7 @@ ANN static inline Type specialid_type(const Env env, struct SpecialId_ *spid, const Exp_Primary* prim) { exp_self(prim)->info->type = spid->type; if(spid->is_const) - exp_getmeta(exp_self(prim)); + exp_setmeta(exp_self(prim), 1); return spid->ck ? spid->ck(env, prim) : spid->type; } diff --git a/src/lib/opfunc.c b/src/lib/opfunc.c index 122e7eff..9d10e537 100644 --- a/src/lib/opfunc.c +++ b/src/lib/opfunc.c @@ -10,12 +10,6 @@ #include "operator.h" #include "import.h" -static inline m_str get_access(const Exp e) { - if(exp_getmeta(e)) - return "non-mutable"; - return !exp_getprot(e) ? NULL : "protected"; -} - OP_CHECK(opck_basic_cast) { const Exp_Cast* cast = (Exp_Cast*)data; return isa(cast->exp->info->type, exp_self(cast)->info->type) > 0 ? @@ -34,7 +28,7 @@ OP_EMIT(opem_basic_cast) { OP_CHECK(opck_const_rhs) { const Exp_Binary* bin = (Exp_Binary*)data; - const m_str access = get_access(bin->rhs); + const m_str access = exp_access(bin->rhs); if(access) ERR_N(bin->rhs->pos, _("cannot assign '%s' on types '%s' and '%s'.\n" " ... (reason: --- right-side operand is %s.)"), @@ -71,7 +65,7 @@ OP_CHECK(opck_unary_meta2) { OP_CHECK(opck_unary) { const Exp_Unary* unary = (Exp_Unary*)data; - const m_str access = get_access(unary->exp); + const m_str access = exp_access(unary->exp); if(access) ERR_N(unary->exp->pos, _("unary operator '%s' cannot be used on %s data-types."), @@ -82,7 +76,7 @@ OP_CHECK(opck_unary) { OP_CHECK(opck_post) { const Exp_Postfix* post = (Exp_Postfix*)data; - const m_str access = get_access(post->exp); + const m_str access = exp_access(post->exp); if(access) ERR_N(post->exp->pos, _("post operator '%s' cannot be used on %s data-type."), s_name(post->op), access) diff --git a/src/parse/scan1.c b/src/parse/scan1.c index d100f323..41535add 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -164,10 +164,10 @@ ANN static inline m_bool scan1_exp_cast(const Env env, const Exp_Cast* cast) { ANN static m_bool scan1_exp_post(const Env env, const Exp_Postfix* post) { CHECK_BB(scan1_exp(env, post->exp)) const m_str access = exp_access(post->exp); - if(access) + if(!access) return GW_OK; ERR_B(post->exp->pos, _("post operator '%s' cannot be used" - " on %S data-type..."), s_name(post->op), access); + " on %s data-type..."), s_name(post->op), access); } ANN static m_bool scan1_exp_call(const Env env, const Exp_Call* exp_call) { -- 2.43.0