From: Jérémie Astor Date: Mon, 13 Apr 2020 21:09:13 +0000 (+0200) Subject: :bug: Fix ptr access X-Git-Tag: nightly~1693 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=e4033d4440dbd3df915235c1d9aa1a1992ab412c;p=gwion.git :bug: Fix ptr access --- diff --git a/src/lib/ptr.c b/src/lib/ptr.c index 152799a1..a3483dec 100644 --- a/src/lib/ptr.c +++ b/src/lib/ptr.c @@ -14,11 +14,17 @@ #include "parse.h" #include "gwi.h" +static m_bool ptr_access(const Env env, const Exp e) { + const m_str access = exp_access(e); + if(!access) + return GW_OK; + ERR_B(e->pos, _("operand is %s"), access); +} + static OP_CHECK(opck_ptr_assign) { const Exp_Binary* bin = (Exp_Binary*)data; - const m_str access = exp_access(exp_self(bin->rhs)); - if(access) - ERR_N(exp_self(bin)->pos, _("right side operand is %s"), access); + CHECK_BO(ptr_access(env, bin->lhs)) + CHECK_BO(ptr_access(env, bin->rhs)) exp_setvar(bin->lhs, 1); Type t = bin->lhs->info->type; do {