From 614d6eeec1b22fc9c1d0e9cfed7bf32b40fcc544 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Wed, 19 Jun 2019 02:18:43 +0200 Subject: [PATCH] :art: Few fixes --- Makefile | 7 +++++++ src/lib/opfunc.c | 3 ++- src/lib/ptr.c | 3 +-- src/parse/check.c | 5 +---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index d1f650e7..20b3fde9 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,14 @@ GW_OBJ=${src_obj} ${ast_obj} ${parse_obj} ${emit_obj} ${oo_obj} ${vm_obj} ${util gwlib_obj := $(filter-out src/main.o, ${GW_OBJ}) CFLAGS += -Iinclude + +ifeq (${BUILD_ON_WINDOWS}, 1) +ifeq (${CC}, gcc) +LDFLAGS += -lm +endif +else LDFLAGS += -lm +endif ifeq ($(shell uname), Linux) LDFLAGS += -lrt -rdynamic diff --git a/src/lib/opfunc.c b/src/lib/opfunc.c index dc17e417..3d183d0a 100644 --- a/src/lib/opfunc.c +++ b/src/lib/opfunc.c @@ -28,8 +28,9 @@ OP_EMIT(opem_basic_cast) { OP_CHECK(opck_const_rhs) { const Exp_Binary* bin = (Exp_Binary*)data; +printf("rhs %p %i\n", bin->rhs, bin->rhs->meta); if(bin->rhs->meta != ae_meta_var) - ERR_N(exp_self(bin)->pos, _("cannot assign '%s' on types '%s' and '%s'.\n" + ERR_N(bin->rhs->pos, _("cannot assign '%s' on types '%s' and '%s'.\n" " ... (reason: --- right-side operand is %s.)"), op2str(bin->op), bin->lhs->type->name, bin->rhs->type->name, access(bin->rhs->meta)) diff --git a/src/lib/ptr.c b/src/lib/ptr.c index 34733335..de20bee5 100644 --- a/src/lib/ptr.c +++ b/src/lib/ptr.c @@ -34,8 +34,7 @@ static INSTR(instr_ptr_assign) { static OP_CHECK(opck_ptr_deref) { const Exp_Unary* unary = (Exp_Unary*)data; - exp_self(unary)->type = nspc_lookup_type1(unary->exp->type->e->owner, insert_symbol(env->gwion->st, get_type_name(env, unary->exp->type->name, 1))); - return exp_self(unary)->type; + return exp_self(unary)->type = nspc_lookup_type1(unary->exp->type->e->owner, insert_symbol(env->gwion->st, get_type_name(env, unary->exp->type->name, 1))); } static OP_CHECK(opck_implicit_ptr) { diff --git a/src/parse/check.c b/src/parse/check.c index 1b9055d4..5544e35d 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -709,10 +709,7 @@ ANN static Type check_exp_unary(const Env env, const Exp_Unary* unary) { .data=(uintptr_t)unary, .pos=exp_self(unary)->pos }; if(unary->exp && !opi.rhs) return NULL; - const Type t = op_check(env, &opi); - if(t && isa(t, t_object) < 0) - exp_self(unary)->meta = ae_meta_value; - return t; + return op_check(env, &opi); } ANN static Type check_exp_if(const Env env, const Exp_If* exp_if) { -- 2.43.0