From 546840e71579ca3fa5a8ecd43f9bde0f4ed5be22 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 24 May 2021 17:04:42 +0200 Subject: [PATCH] :art: Update --- fmt | 2 +- include/env/env.h | 1 + plug | 2 +- src/gwion.c | 6 +++--- src/lib/object_op.c | 11 +++++++---- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/fmt b/fmt index 17bb2115..d58f01e7 160000 --- a/fmt +++ b/fmt @@ -1 +1 @@ -Subproject commit 17bb211543ca36b9c53d884515afded758547945 +Subproject commit d58f01e7f844cab87613a8084dee3e69d1582cac diff --git a/include/env/env.h b/include/env/env.h index c9372b11..4b55911e 100644 --- a/include/env/env.h +++ b/include/env/env.h @@ -47,6 +47,7 @@ ANN m_bool already_defined(const Env env, const Symbol s, const loc_t pos); ANN m_bool traverse_func_template(const Env, const Func_Def); ANN void env_err(const Env, const loc_t pos, const m_str fmt, ...); ANN void env_warn(const Env, const loc_t pos, const m_str fmt, ...); +ANN void env_error_footer(const Env env); ANN Value global_string(const Env env, const m_str str); ANN void release_ctx(struct Env_Scope_ *a, struct Gwion_* gwion); diff --git a/plug b/plug index 4587cd02..fb296d97 160000 --- a/plug +++ b/plug @@ -1 +1 @@ -Subproject commit 4587cd028705ac2766c1897bb5d1e398b0b1de46 +Subproject commit fb296d97fea12ee3e44a1120c47033dfe5325a62 diff --git a/src/gwion.c b/src/gwion.c index 3bc2ebc4..0ab82621 100644 --- a/src/gwion.c +++ b/src/gwion.c @@ -156,10 +156,10 @@ ANN void gwion_end(const Gwion gwion) { mempool_end(gwion->mp); } -ANN static void env_header(const Env env) { +ANN void env_error_footer(const Env env) { if(env->class_def) gwerr_secondary("in class", env->name, env->class_def->info->cdef->pos); - if(env->func && env->func != (Func)1 && env->func->def) + if(env->func && env->func->def) gwerr_secondary("in function", env->name, env->func->def->base->pos); } @@ -172,7 +172,7 @@ ANN static void env_xxx(const Env env, const loc_t pos, const m_str fmt, va_list char c[size + 1]; vsprintf(c, fmt, arg); gwerr_basic(c, NULL, NULL, env->name, pos, 0); - env_header(env); + env_error_footer(env); #endif } diff --git a/src/lib/object_op.c b/src/lib/object_op.c index a1b6525a..104d6532 100644 --- a/src/lib/object_op.c +++ b/src/lib/object_op.c @@ -179,10 +179,13 @@ OP_CHECK(opck_object_dot) { } CHECK_BN(not_from_owner_class(env, the_base, value, exp_self(member)->pos)); if(!env->class_def || isa(env->class_def, value->from->owner_class) < 0) { - if(GET_FLAG(value, private)) - ERR_N(exp_self(member)->pos, - _("can't access private '%s' outside of class..."), value->name); - else if(GET_FLAG(value, protect)) + if(GET_FLAG(value, private)) { + gwerr_basic("invalid variable access", "is private", NULL, + env->name, exp_self(member)->pos, 0); + env_error_footer(env); + gwerr_secondary("declared here", value->from->filename, value->from->loc); + env->context->error = true; + } else if(GET_FLAG(value, protect)) exp_setprot(exp_self(member), 1); } if(base_static && vflag(value, vflag_member)) -- 2.43.0