From: Jérémie Astor Date: Sun, 25 Jul 2021 18:30:19 +0000 (+0200) Subject: :bug: bug fixes X-Git-Tag: nightly~516 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=a8d799a27a07dac15e257ba8b946766436a21dbf;p=gwion.git :bug: bug fixes --- diff --git a/src/emit/emit.c b/src/emit/emit.c index 6439c4a7..5a215ba9 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -2120,8 +2120,6 @@ ANN static m_bool _emit_stmt_each(const Emitter emit, const Stmt_Each stmt, emit_local(emit, emit->gwion->type[et_int]); const Instr tomem = emit_add_instr(emit, Reg2Mem); tomem->m_val = offset; - const Instr s1 = emit_add_instr(emit, MemSetImm); - s1->m_val = offset + SZ_INT; const Instr loop_idx = emit_add_instr(emit, MemSetImm); loop_idx->m_val = offset + SZ_INT; loop_idx->m_val2 = -1; diff --git a/src/parse/check.c b/src/parse/check.c index a27b538c..1ee979c5 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1517,7 +1517,7 @@ ANN static m_bool check_func_overload(const Env env, const Func_Def fdef) { fbflag(f2->def->base, fbflag_unary) && fbflag(f1->def->base, fbflag_postfix) == fbflag(f2->def->base, fbflag_postfix)) - ERR_B(f2->def->base->td->pos, + ERR_B(f2->def->base->pos, _("global function '%s' already defined" " for those arguments"), s_name(fdef->base->xid)) diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 6d6a6f8b..c7f41554 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -116,7 +116,7 @@ ANN static m_bool scan1_decl(const Env env, const Exp_Decl *decl) { set_vflag(v, vflag_fglobal); // file global } else if (GET_FLAG(decl->td, global)) SET_FLAG(v, global); - else if(v->type != env->gwion->type[et_auto] && v->type != env->class_def) { + else if(v->type != env->gwion->type[et_auto] && (v->type != env->class_def || env->scope->depth)) { type_addref(v->type); set_vflag(v, vflag_inner); // file global } diff --git a/src/vm/vm.c b/src/vm/vm.c index 05b218ed..01b24041 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -994,10 +994,10 @@ vm_run(const VM *vm) { // lgtm [cpp/use-of-goto] autoloop: *(m_bit **)(mem + VAL2 + SZ_INT) = m_vector_addr(ARRAY(*(M_Object *)(mem + VAL2 - SZ_INT)), - *(m_uint *)(mem + VAL2) + 1); + ++*(m_uint *)(mem + VAL2)); BRANCH_DISPATCH( m_vector_size(ARRAY(*(M_Object *)(mem + VAL2 - SZ_INT))) == - ++*(m_uint *)(mem + VAL2)); + *(m_uint *)(mem + VAL2)); arraytop: if (*(m_uint *)(reg - SZ_INT * 2) < *(m_uint *)(reg - SZ_INT)) goto newobj;