From e4033d4440dbd3df915235c1d9aa1a1992ab412c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Mon, 13 Apr 2020 23:09:13 +0200 Subject: [PATCH] :bug: Fix ptr access --- src/lib/ptr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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 { -- 2.43.0