]> Nishi Git Mirror - gwion.git/commitdiff
:art: Few fixes
authorfennecdjay <astor.jeremie@wanadoo.fr>
Wed, 19 Jun 2019 00:18:43 +0000 (02:18 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Wed, 19 Jun 2019 00:19:16 +0000 (02:19 +0200)
Makefile
src/lib/opfunc.c
src/lib/ptr.c
src/parse/check.c

index d1f650e762a81326899f4948f613abef5494c2a3..20b3fde9ad27faafffa6b5cddcf666135cae39e1 100644 (file)
--- 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
index dc17e417e1b49c47a0b11b7efc9eb67daebfab37..3d183d0a43c1d8bba8551e60a9c37614828fa4cc 100644 (file)
@@ -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))
index 347333351821b7afcca160d1a711d1629da83135..de20bee5321b20ae56b5580bf383f592b2e7a9ed 100644 (file)
@@ -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) {
index 1b9055d48016f110b8aebd8e9af63e8c1816960a..5544e35da925a13886b293a2d1f9f6d9501d34fb 100644 (file)
@@ -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) {