From 0d25d6f60f9668bd77322f0f592c5cc764795557 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 10 Aug 2021 11:06:31 +0200 Subject: [PATCH] :art: Start fixing --- src/emit/emit.c | 13 +++++++++++-- src/parse/check.c | 1 + src/parse/scan0.c | 1 - 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/emit/emit.c b/src/emit/emit.c index 2144d6c5..a09eeab8 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1277,7 +1277,16 @@ ANN m_bool traverse_dot_tmpl(const Emitter emit, const struct dottmpl_ *dt) { } static inline m_bool push_func_code(const Emitter emit, const Func f) { - if (!vector_size(&emit->code->instr)) return GW_OK; + if (!vector_size(&emit->code->instr)) { + if(fflag(f, fflag_tmpl)) { + // we are sporking a template + // assume static call for now + const Instr instr = emit_add_instr(emit, RegSetImm); + instr->m_val = (m_uint)f->code; + instr->m_val2 = (m_uint)-SZ_INT; + } + return GW_OK; + } const Instr instr = (Instr)vector_back(&emit->code->instr); if (instr->opcode == eDotTmplVal) { size_t len = strlen(f->name); @@ -1484,7 +1493,7 @@ ANN m_bool emit_exp_call1(const Emitter emit, const Func f, push_func_code(emit, f); else if (vector_size(&emit->code->instr)) { const Instr back = (Instr)vector_back(&emit->code->instr); - if ((f_instr)(m_uint)back->opcode == DotFunc) back->m_val = f->vt_index; + if (back->opcode == eDotFunc) back->m_val = f->vt_index; } if (vector_size(&emit->code->instr) && vflag(f->value_ref, vflag_member) && is_fptr(emit->gwion, f->value_ref->type)) { diff --git a/src/parse/check.c b/src/parse/check.c index 75535e96..ac361855 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -628,6 +628,7 @@ static void function_alternative(const Env env, const Type f, const Exp args, print_current_args(args); else gw_err(_("and not:\n {G}void{0}\n")); + if (env->context) env->context->error = true; } ANN static m_uint get_type_number(Specialized_List list) { diff --git a/src/parse/scan0.c b/src/parse/scan0.c index 7cdfa37d..a72980bb 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -345,7 +345,6 @@ ANN static Type scan0_class_def_init(const Env env, const Class_Def cdef) { t->flag |= cdef->flag; // add_type(env, t->info->value->from->owner, t); cdef_flag(cdef, t); - if (cdef->base.ext && cdef->base.ext->array) set_tflag(t, tflag_typedef); return t; } -- 2.43.0