From: fennecdjay Date: Sun, 6 Oct 2019 12:09:57 +0000 (+0200) Subject: :art: Few fixes X-Git-Tag: nightly~2198^2~135 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=63c6d7b693bee46c179ccb108998fb16326f8960;p=gwion.git :art: Few fixes --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 7d14cf39..b6283e20 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -963,7 +963,9 @@ ANN Instr emit_exp_call1(const Emitter emit, const Func f) { if(emit->env->func != f) CHECK_BO(emit_template_code(emit, f)) else { - const Instr back = (Instr)vector_back(&emit->code->instr); +//assert(vector_size(&emit->code->instr)); + const Instr back = (Instr) vector_size(&emit->code->instr) ? + vector_back(&emit->code->instr) : emit_add_instr(emit, RegPushImm); back->opcode = ePushStaticCode; back->m_val = 0; } @@ -1697,6 +1699,12 @@ ANN static m_bool emit_member_func(const Emitter emit, const Exp_Dot* member) { } ANN static inline m_bool emit_member(const Emitter emit, const Value v, const uint emit_addr) { + if(is_class(emit->gwion, v->type)) { + const Instr instr= emit_add_instr(emit, RegSetImm); + instr->m_val = v->type; + return GW_OK; + } +//assert(!is_class(emit->gwion, v->type)); const m_uint size = v->type->size; const Instr instr = emit_kind(emit, size, emit_addr, dotmember); instr->m_val = v->from->offset; diff --git a/src/parse/check.c b/src/parse/check.c index c6ebbd49..bc39a88e 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -33,7 +33,7 @@ ANN static m_bool check_internal(const Env env, const Symbol sym, struct Op_Import opi = { .op=sym, .lhs=e->type, .rhs=t, .data=(uintptr_t)&imp, .pos=e->pos }; CHECK_OB(op_check(env, &opi)) - e->nspc = env->curr; + assert(e->nspc); return GW_OK; } @@ -855,7 +855,8 @@ ANN static Type check_exp_call(const Env env, Exp_Call* exp) { ERR_O(exp_self(exp)->pos, _("template call of non-template function.")) if(t->e->d.func->def->base->tmpl->call) { if(env->func == t->e->d.func) { - CHECK_OO(check_exp(env, exp->args)) + if(exp->args) + CHECK_OO(check_exp(env, exp->args)) exp->m_func = env->func; return env->func->def->base->ret_type; } else