]> Nishi Git Mirror - gwion.git/commitdiff
:art: clean is_static_call
authorfennecdjay <fennecdjay@gmail.com>
Sat, 3 Sep 2022 09:16:20 +0000 (11:16 +0200)
committerfennecdjay <fennecdjay@gmail.com>
Sat, 3 Sep 2022 09:16:20 +0000 (11:16 +0200)
include/emit.h
src/emit/emit.c
src/lib/object_op.c

index 1b4ad3a6a1422a80e73238f84d1bc04fda60ca2c..819506f8e278d598788257a30b580346f37f12ea 100644 (file)
@@ -95,12 +95,12 @@ ANN static inline Instr emit_compound_addref(const Emitter emit, const Type t,
                                  : emit_struct_addref(emit, t, size, emit_var);
 }
 
-ANN static inline bool is_static_call(const Emitter emit, const Exp e) {
+ANN static inline bool is_static_call(const Exp e) {
   if (e->exp_type != ae_exp_dot) return true;
   const Exp_Dot *member = &e->d.exp_dot;
-  return GET_FLAG(member->base->type, final) ||
-         !vflag(exp_self(member)->type->info->value, vflag_member) ||
-         is_class(emit->gwion, member->base->type) ||
+  return GET_FLAG(e->type, final) ||
+         GET_FLAG(member->base->type, final) ||
+//         GET_FLAG(e->type->info->func, static) ||
          member->base->exp_type == ae_exp_cast;
 }
 
index 320b515d4779c16d1abf2ffa4722f5f152941120..51f30a64810f4d5921f53cc93b14a92a70c7b71d 100644 (file)
@@ -1300,7 +1300,7 @@ ANN static m_bool _emit_exp_call(const Emitter emit, const Exp_Call *exp_call) {
     CHECK_BB(emit_func_args(emit, exp_call));
   if (is_func(emit->gwion, t)) // is_callable needs type
     CHECK_BB(emit_exp_call1(emit, t->info->func,
-                            is_static_call(emit, exp_call->func)));
+                            is_static_call(exp_call->func)));
   else {
     struct Op_Import opi = {.op   = insert_symbol("@ctor"),
                             .rhs  = t,
index 3f61a2dbcf0fe3b4189487c8bb49374de01cbd15..542abd6f0dfe8ee24206b65bf0eb90c3e2169b08 100644 (file)
@@ -147,7 +147,7 @@ ANN static void emit_member_func(const Emitter emit, const Exp_Dot *member) {
       instr->m_val = (m_uint)f;
       return;
     }
-  } else if (is_static_call(emit, exp_self(member))) {
+  } else if (is_static_call(exp_self(member))) {
     if (member->is_call && f == emit->env->func) return;
     const Instr func_i = emit_add_instr(emit, f->code ? RegPushImm : SetFunc);
     func_i->m_val      = (m_uint)f->code ?: (m_uint)f;