From: Jérémie Astor Date: Tue, 27 Apr 2021 18:48:23 +0000 (+0200) Subject: :art: More on The great uncursing X-Git-Tag: nightly~714 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=d699c010414538af7665a514e56b3ec34e4af641;p=gwion.git :art: More on The great uncursing --- diff --git a/include/import.h b/include/import.h index 3f25a51b..373847f5 100644 --- a/include/import.h +++ b/include/import.h @@ -54,7 +54,7 @@ OP_EMIT(opem_new); ANN2(1,3) static inline M_Object new_object_str(const Gwion gwion, const VM_Shred shred, const m_str str) { struct loc_t_ loc = {}; - DECL_OO(const Type, t, = str2type(gwion, str, loc)) + DECL_OO(const Type, t, = str2type(gwion, str, loc)); return new_object(gwion->mp, shred, t); } #endif diff --git a/plug b/plug index 9386165c..109a1b84 160000 --- a/plug +++ b/plug @@ -1 +1 @@ -Subproject commit 9386165c3380116963344573104bcb97678297c7 +Subproject commit 109a1b84ab2b525d475dbca811325cc6b5adf693 diff --git a/src/emit/emit.c b/src/emit/emit.c index 2a26d304..50bfd110 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -194,7 +194,7 @@ ANN static m_bool emit_defers2(const Emitter emit) { ANN static m_int _frame_pop(const Emitter emit) { Frame *frame = emit->code->frame; - DECL_OB(const Local*, l, = (Local*)vector_pop(&frame->stack)) + DECL_OB(const Local*, l, = (Local*)vector_pop(&frame->stack)); frame->curr_offset -= l->type->size; if(l->skip) return _frame_pop(emit); @@ -400,7 +400,7 @@ ANN2(1,2) m_bool emit_instantiate_object(const Emitter emit, const Type type, const Array_Sub array, const m_bool is_ref) { emit_notpure(emit); if(type->array_depth) { - DECL_OB(ArrayInfo*, info, = emit_array_extend_inner(emit, type, array ? array->exp : NULL, is_ref)) + DECL_OB(ArrayInfo*, info, = emit_array_extend_inner(emit, type, array ? array->exp : NULL, is_ref)); return GW_OK; } else if(!is_ref) { const Instr instr = emit_add_instr(emit, ObjectInstantiate); @@ -1423,7 +1423,7 @@ ANN static m_bool emit_exp_if(const Emitter emit, const Exp_If* exp_if) { exp_setvar(e, 1); exp_setvar(exp_if->else_exp, 1); } - DECL_OB(const Instr, op, = emit_flow(emit, exp_if->cond)) + DECL_OB(const Instr, op, = emit_flow(emit, exp_if->cond)); CHECK_BB(emit_exp_pop_next(emit, exp_if->if_exp ?: exp_if->cond)); const Instr op2 = emit_add_instr(emit, Goto); op->m_val = emit_code_size(emit); @@ -1528,7 +1528,7 @@ ANN static m_bool emit_if_const(const Emitter emit, const Stmt_If stmt) { ANN static m_bool emit_if(const Emitter emit, const Stmt_If stmt) { if(stmt->cond->exp_type == ae_exp_primary && stmt->cond->d.prim.prim_type == ae_prim_num) return emit_if_const(emit, stmt); - DECL_OB(const Instr, op, = emit_flow(emit, stmt->cond)) + DECL_OB(const Instr, op, = emit_flow(emit, stmt->cond)); CHECK_BB(scoped_stmt(emit, stmt->if_body, 1)); const Instr op2 = emit_add_instr(emit, Goto); op->m_val = emit_code_size(emit); @@ -1705,7 +1705,7 @@ ANN static m_bool emit_stmt_varloop(const Emitter emit, const Stmt_VarLoop stmt) ANN static m_bool _emit_stmt_for(const Emitter emit, const Stmt_For stmt, m_uint *action_index) { CHECK_BB(emit_stmt(emit, stmt->c1, 1)); const m_uint index = emit_code_size(emit); - DECL_OB(const Instr, op, = emit_flow(emit, stmt->c2->d.stmt_exp.val)) + DECL_OB(const Instr, op, = emit_flow(emit, stmt->c2->d.stmt_exp.val)); CHECK_BB(scoped_stmt(emit, stmt->body, 1)); *action_index = emit_code_size(emit); if(stmt->c3) { diff --git a/src/env/env_utils.c b/src/env/env_utils.c index 2bac3459..c3672d9c 100644 --- a/src/env/env_utils.c +++ b/src/env/env_utils.c @@ -54,7 +54,7 @@ ANN Type find_initial(const Env env, const Symbol xid) { #undef RETURN_TYPE ANN Type find_type(const Env env, Type_Decl *path) { - DECL_OO(const Type, type, = find_initial(env, path->xid)) + DECL_OO(const Type, type, = find_initial(env, path->xid)); while((path = path->next) && type && type->nspc) { const Nspc nspc = type->nspc; const Type child = find_in_parent(type, path->xid); diff --git a/src/import/import_cdef.c b/src/import/import_cdef.c index 327bffbf..9d298bb3 100644 --- a/src/import/import_cdef.c +++ b/src/import/import_cdef.c @@ -69,7 +69,7 @@ ANN static Type type_finish(const Gwi gwi, const Type t) { ANN2(1,2) Type gwi_class_ini(const Gwi gwi, const m_str name, const m_str parent) { struct ImportCK ck = { .name=name }; CHECK_BO(check_typename_def(gwi, &ck)); - DECL_OO(Type_Decl *,td, = gwi_str2td(gwi, parent ?: "Object")) + DECL_OO(Type_Decl *,td, = gwi_str2td(gwi, parent ?: "Object")); Tmpl* tmpl = ck.tmpl ? new_tmpl_base(gwi->gwion->mp, ck.tmpl) : NULL; if(tmpl) CHECK_BO(template_push_types(gwi->gwion->env, tmpl)); diff --git a/src/import/import_checker.c b/src/import/import_checker.c index 221c3f0f..46ebe154 100644 --- a/src/import/import_checker.c +++ b/src/import/import_checker.c @@ -73,13 +73,13 @@ ANN Symbol str2sym(const Gwion gwion, const m_str path, const loc_t pos) { // only in enum.c ANN ID_List str2symlist(const Gwion gwion, const m_str path, const loc_t pos) { - DECL_OO(const Symbol, sym, = str2sym(gwion, path, pos)) + DECL_OO(const Symbol, sym, = str2sym(gwion, path, pos)); return new_id_list(gwion->mp, sym); } ANN Var_Decl str2var(const Gwion gwion, const m_str path, const loc_t pos) { struct td_checker tdc = { .str=path, .pos=pos }; - DECL_OO(const Symbol, sym, = __str2sym(gwion, &tdc)) + DECL_OO(const Symbol, sym, = __str2sym(gwion, &tdc)); struct AC ac = { .str = tdc.str, .pos=pos }; CHECK_BO(ac_run(gwion, &ac)); const Array_Sub array = ac.depth ? @@ -89,12 +89,12 @@ ANN Var_Decl str2var(const Gwion gwion, const m_str path, const loc_t pos) { // only in udef.c ANN Var_Decl_List str2varlist(const Gwion gwion, const m_str path, const loc_t pos) { - DECL_OO(const Var_Decl, var, = str2var(gwion, path, pos)) + DECL_OO(const Var_Decl, var, = str2var(gwion, path, pos)); return new_var_decl_list(gwion->mp, var, NULL); } ANN static ID_List _tmpl_list(const Gwion gwion, struct td_checker *tdc) { - DECL_OO(const Symbol, sym, = __str2sym(gwion, tdc)) + DECL_OO(const Symbol, sym, = __str2sym(gwion, tdc)); ID_List next = NULL; if(*tdc->str == ',') { ++tdc->str; @@ -185,7 +185,7 @@ ANN static inline uint get_n(struct td_checker *tdc, const char c) { ANN static Type_Decl* _str2td(const Gwion gwion, struct td_checker *tdc) { const uint ref = get_n(tdc, '&'); - DECL_OO(const Symbol, sym, = __str2sym(gwion, tdc)) + DECL_OO(const Symbol, sym, = __str2sym(gwion, tdc)); struct AC ac = { .str = tdc->str, .pos=tdc->pos }; CHECK_BO(ac_run(gwion, &ac)); tdc->str = ac.str; @@ -216,7 +216,7 @@ ANN static Type_Decl* _str2td(const Gwion gwion, struct td_checker *tdc) { ANN Type_Decl* str2td(const Gwion gwion, const m_str str, const loc_t pos) { struct td_checker tdc = { .str=str, .pos=pos }; - DECL_OO(Type_Decl *, td, = _str2td(gwion, &tdc)) + DECL_OO(Type_Decl *, td, = _str2td(gwion, &tdc)); if(*tdc.str) { free_type_decl(gwion->mp, td); GWION_ERR_O(pos, "excedental character '%c'", *tdc.str); @@ -225,7 +225,7 @@ ANN Type_Decl* str2td(const Gwion gwion, const m_str str, const loc_t pos) { } ANN Type str2type(const Gwion gwion, const m_str str, const loc_t pos) { - DECL_OO(Type_Decl *, td, = str2td(gwion, str, pos)) + DECL_OO(Type_Decl *, td, = str2td(gwion, str, pos)); const Type t = known_type(gwion->env, td); free_type_decl(gwion->mp, td); return t; @@ -248,7 +248,7 @@ ANN static void td_fullname(const Env env, GwText *text, const Type t) { ANN static m_bool td_info_run(const Env env, struct td_info* info) { Type_List tl = info->tl; do { - DECL_OB(const Type, t, = known_type(env, tl->td)) + DECL_OB(const Type, t, = known_type(env, tl->td)); td_fullname(env, &info->text, t); if(tl->next) text_add(&info->text, ","); diff --git a/src/import/import_enum.c b/src/import/import_enum.c index 8bda119b..8c628090 100644 --- a/src/import/import_enum.c +++ b/src/import/import_enum.c @@ -49,7 +49,7 @@ void Append(DL_Enum* d, const ID_List list) { //! TODO: change return type to m_bool ANN m_int gwi_enum_add(const Gwi gwi, const m_str name, const m_uint i) { CHECK_BB(ck_ok(gwi, ck_edef)); - DECL_OB(const ID_List, list, = gwi_str2symlist(gwi, name)) + DECL_OB(const ID_List, list, = gwi_str2symlist(gwi, name)); add2list(gwi->ck, list); vector_add(&gwi->ck->v, (vtype)i); return GW_OK; diff --git a/src/import/import_fdef.c b/src/import/import_fdef.c index 101c6498..2815a729 100644 --- a/src/import/import_fdef.c +++ b/src/import/import_fdef.c @@ -96,7 +96,7 @@ ANN m_int gwi_func_arg(const Gwi gwi, const restrict m_str t, const restrict m_s gwi->ck->variadic = 1; return GW_OK; } - DECL_OB(Type_Decl*, td, = gwi_str2td(gwi, t)) + DECL_OB(Type_Decl*, td, = gwi_str2td(gwi, t)); const Var_Decl var = gwi_str2var(gwi, n); if(var) { const Arg_List arg = new_arg_list(gwi->gwion->mp, td, var, NULL); @@ -125,7 +125,7 @@ ANN static m_bool section_fptr(const Gwi gwi, const Fptr_Def fdef) { ANN Type gwi_fptr_end(const Gwi gwi, const ae_flag flag) { CHECK_BO(ck_ok(gwi, ck_fdef)); - DECL_OO(const Fptr_Def, fptr, = import_fptr(gwi)) + DECL_OO(const Fptr_Def, fptr, = import_fptr(gwi)); fptr->base->flag |= flag; if(safe_tflag(gwi->gwion->env->class_def, tflag_tmpl)/* && !fptr->base->tmpl*/) { section_fptr(gwi, fptr); diff --git a/src/import/import_udef.c b/src/import/import_udef.c index 759a5ddb..2220377a 100644 --- a/src/import/import_udef.c +++ b/src/import/import_udef.c @@ -16,7 +16,7 @@ // move me ANN Exp make_exp(const Gwi gwi, const m_str type, const m_str name) { - DECL_OO(Type_Decl*, td, = gwi_str2td(gwi, type)) + DECL_OO(Type_Decl*, td, = gwi_str2td(gwi, type)); const Var_Decl_List vlist = gwi_str2varlist(gwi, name); if(vlist) return new_exp_decl(gwi->gwion->mp, td, vlist, gwi->loc); @@ -33,8 +33,8 @@ ANN m_int gwi_union_ini(const Gwi gwi, const m_str name) { ANN m_int gwi_union_add(const Gwi gwi, const restrict m_str type, const restrict m_str name) { CHECK_BB(ck_ok(gwi, ck_udef)); - DECL_OB(Type_Decl*, td, = str2td(gwi->gwion, type, gwi->loc)) - DECL_OB(const Symbol, xid, = str2sym(gwi->gwion, name, gwi->loc)) + DECL_OB(Type_Decl*, td, = str2td(gwi->gwion, type, gwi->loc)); + DECL_OB(const Symbol, xid, = str2sym(gwi->gwion, name, gwi->loc)); const Union_List l = new_union_list(gwi->gwion->mp, td, xid, gwi->loc); l->next = gwi->ck->list; gwi->ck->list = l; diff --git a/src/lib/instr.c b/src/lib/instr.c index 35ae9d14..41f83473 100644 --- a/src/lib/instr.c +++ b/src/lib/instr.c @@ -26,7 +26,7 @@ ANN static Func_Def from_base(const Env env, struct dottmpl_ *const dt, const Ns const Func_Def fdef = dt->def ?: dt->base; const Symbol sym = func_symbol(env, nspc->name, s_name(fdef->base->xid), "template", dt->base->base->tmpl->base); - DECL_OO(const Value, v, = nspc_lookup_value0(nspc, sym) ?: nspc_lookup_value0(nspc, fdef->base->xid)) + DECL_OO(const Value, v, = nspc_lookup_value0(nspc, sym) ?: nspc_lookup_value0(nspc, fdef->base->xid)); if(is_class(env->gwion, v->type)) return NULL; if(vflag(v, vflag_builtin)) { @@ -45,7 +45,7 @@ ANN static Func_Def from_base(const Env env, struct dottmpl_ *const dt, const Ns } ANN static Func_Def traverse_tmpl(const Emitter emit, struct dottmpl_ *const dt, const Nspc nspc) { - DECL_OO(const Func_Def, def, = from_base(emit->env, dt, nspc)) + DECL_OO(const Func_Def, def, = from_base(emit->env, dt, nspc)); CHECK_BO(traverse_dot_tmpl(emit, dt)); if(dt->xfun) builtin_func(emit->gwion->mp, def->base->func, dt->xfun); diff --git a/src/lib/lib_func.c b/src/lib/lib_func.c index 701f5b65..d2964485 100644 --- a/src/lib/lib_func.c +++ b/src/lib/lib_func.c @@ -81,8 +81,8 @@ ANN static m_bool fptr_tmpl_push(const Env env, struct FptrInfo *info) { } static m_bool td_match(const Env env, Type_Decl *id[2]) { - DECL_OB(const Type, t0, = known_type(env, id[0])) - DECL_OB(const Type, t1, = known_type(env, id[1])) + DECL_OB(const Type, t0, = known_type(env, id[0])); + DECL_OB(const Type, t1, = known_type(env, id[1])); if(isa(t0, t1) > 0) return GW_OK; return t1 == env->gwion->type[et_auto] ? GW_OK:GW_ERROR; @@ -169,7 +169,7 @@ ANN static Type fptr_type(const Env env, struct FptrInfo *info) { info->lhs = v->type->info->func; } } else { - DECL_OO(const Type, t, = nspc_lookup_type1(nspc, info->lhs->def->base->xid)) + DECL_OO(const Type, t, = nspc_lookup_type1(nspc, info->lhs->def->base->xid)); info->lhs = actual_type(env->gwion, t)->info->func; } Type type = NULL; diff --git a/src/lib/tmpl_info.c b/src/lib/tmpl_info.c index 79f91cfd..73d86613 100644 --- a/src/lib/tmpl_info.c +++ b/src/lib/tmpl_info.c @@ -42,7 +42,7 @@ ANN static inline size_t tmpl_set(struct tmpl_info* info, const m_str str) { } ANN static ssize_t template_size(const Env env, struct tmpl_info* info) { - DECL_OB(const m_str, str, = tl2str(env->gwion, info->td->types, info->td->pos)) + DECL_OB(const m_str, str, = tl2str(env->gwion, info->td->types, info->td->pos)); const size_t tmpl_sz = tmpl_set(info, str); const m_str base = type2str(env->gwion, info->base, info->td->pos); return tmpl_sz + tmpl_set(info, base) + 4; diff --git a/src/parse/check.c b/src/parse/check.c index 13335767..9a21d52f 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -632,12 +632,12 @@ ANN static Func predefined_func(const Env env, const Value v, Exp_Call *exp, const Tmpl *tm) { Tmpl tmpl = { .call=tm->call }; exp->tmpl = &tmpl; - DECL_OO(const Func, func, = get_template_func(env, exp, v)) + DECL_OO(const Func, func, = get_template_func(env, exp, v)); return v->d.func_ref = func; } ANN static Type check_predefined(const Env env, Exp_Call *exp, const Value v, const Tmpl *tm, const Func_Def fdef) { - DECL_OO(const Func, func, = v->d.func_ref ?: predefined_func(env, v, exp, tm)) + DECL_OO(const Func, func, = v->d.func_ref ?: predefined_func(env, v, exp, tm)); if(!fdef->base->ret_type) { // template fptr struct EnvSet es = { .env=env, .data=env, .func=(_exp_func)check_cdef, .scope=env->scope->depth, .flag=tflag_check }; @@ -681,15 +681,15 @@ ANN static Type_List check_template_args(const Env env, Exp_Call *exp, const Tmp ANN static Type check_exp_call_template(const Env env, Exp_Call *exp) { const Type t = exp->func->type; - DECL_OO(const Value, value, = type_value(env->gwion, t)) + DECL_OO(const Value, value, = type_value(env->gwion, t)); const Func_Def fdef = value->d.func_ref ? value->d.func_ref->def : t->info->func->def; Tmpl *tm = fdef->base->tmpl; if(tm->call) return check_predefined(env, exp, value, tm, fdef); - DECL_OO(const Type_List, tl, = check_template_args(env, exp, tm, fdef)); + DECL_OO(const Type_List, tl, = check_template_args(env, exp, tm, fdef));; Tmpl tmpl = { .call=tl }; ((Exp_Call*)exp)->tmpl = &tmpl; - DECL_OO(const Func,func, = get_template_func(env, exp, value)) + DECL_OO(const Func,func, = get_template_func(env, exp, value)); return func->def->base->ret_type; } @@ -750,7 +750,7 @@ ANN void call_add_effect(const Env env, const Func func, const loc_t pos) { } } ANN Type check_exp_call1(const Env env, Exp_Call *const exp) { - DECL_BO(const m_bool, ret, = func_check(env, exp)) + DECL_BO(const m_bool, ret, = func_check(env, exp)); if(!ret) return exp_self(exp)->type; const Type t = actual_type(env->gwion, exp->func->type); @@ -813,7 +813,7 @@ ANN static Type check_exp_binary(const Env env, const Exp_Binary* bin) { } ANN static Type check_exp_cast(const Env env, const Exp_Cast* cast) { - DECL_OO(const Type, t, = check_exp(env, cast->exp)) + DECL_OO(const Type, t, = check_exp(env, cast->exp)); CHECK_OO((exp_self(cast)->type = known_type(env, cast->td))); struct Op_Import opi = { .op=insert_symbol("$"), .lhs=t, .rhs=exp_self(cast)->type, .data=(uintptr_t)cast, .pos=exp_self(cast)->pos }; @@ -845,7 +845,7 @@ ANN static m_bool predefined_call(const Env env, const Type t, const loc_t pos) ANN static Type check_exp_call(const Env env, Exp_Call* exp) { if(exp->tmpl) { - DECL_BO(const m_bool, ret, = func_check(env, exp)) + DECL_BO(const m_bool, ret, = func_check(env, exp)); if(!ret) return exp_self(exp)->type; const Type t = actual_type(env->gwion, exp->func->type); @@ -863,7 +863,7 @@ ANN static Type check_exp_call(const Env env, Exp_Call* exp) { CHECK_BO(predefined_call(env, t, exp_self(exp)->pos)); } const Value v = type_value(env->gwion, t); - DECL_OO(const Func, f, = find_template_match(env, v, exp)) + DECL_OO(const Func, f, = find_template_match(env, v, exp)); exp->func->type = f->value_ref->type; return f->def->base->ret_type; } @@ -878,14 +878,14 @@ ANN static Type check_exp_unary(const Env env, const Exp_Unary* unary) { } struct Op_Import opi = { .op=unary->op, .rhs=rhs, .data=(uintptr_t)unary, .pos=exp_self(unary)->pos }; - DECL_OO(const Type, ret, = op_check(env, &opi)) + DECL_OO(const Type, ret, = op_check(env, &opi)); const Type t = actual_type(env->gwion, ret); CHECK_BO(ensure_traverse(env, t)); return ret; } ANN static Type _flow(const Env env, const Exp e, const m_bool b) { - DECL_OO(const Type, type, = check_exp(env, e)) + DECL_OO(const Type, type, = check_exp(env, e)); struct Op_Import opi = { .op=insert_symbol(b ? "@conditionnal" : "@unconditionnal"), .rhs=type, .pos=e->pos, .data=(uintptr_t)e }; return op_check(env, &opi); @@ -894,9 +894,9 @@ ANN static Type _flow(const Env env, const Exp e, const m_bool b) { ANN static Type check_exp_if(const Env env, const Exp_If* exp_if) { const Exp e = exp_if->if_exp ?: exp_if->cond; - DECL_OO(const Type, cond, = check_flow(env, exp_if->cond)) - DECL_OO(const Type, if_exp, = (exp_if->if_exp ? check_exp(env, exp_if->if_exp) : cond)) - DECL_OO(const Type, else_exp, = check_exp(env, exp_if->else_exp)) + DECL_OO(const Type, cond, = check_flow(env, exp_if->cond)); + DECL_OO(const Type, if_exp, = (exp_if->if_exp ? check_exp(env, exp_if->if_exp) : cond)); + DECL_OO(const Type, else_exp, = check_exp(env, exp_if->else_exp)); const uint meta = exp_getmeta(e) || exp_getmeta(exp_if->else_exp); exp_setmeta(exp_self(exp_if), meta); @@ -982,7 +982,7 @@ ANN static Type check_exp_lambda(const Env env, const Exp_If* exp_if NUSED) { return env->gwion->type[et_lambda]; } ANN static Type check_exp_td(const Env env, Type_Decl **td) { - DECL_OO(const Type, t, = known_type(env, *td)) + DECL_OO(const Type, t, = known_type(env, *td)); return type_class(env->gwion, t); } @@ -1050,18 +1050,18 @@ ANN static inline m_bool for_empty(const Env env, const Stmt_For stmt) { } ANN static inline Type foreach_type(const Env env, const Exp exp) { - DECL_OO(Type, et, = check_exp(env, exp)) + DECL_OO(Type, et, = check_exp(env, exp)); if(isa(et, env->gwion->type[et_array]) < 0) ERR_O(exp->pos, _("type '%s' is not array.\n" " This is not allowed in foreach loop"), et->name) - DECL_OO(Type, base, = typedef_base(et)) - DECL_OO(const Type, t, = array_base(base)) + DECL_OO(Type, base, = typedef_base(et)); + DECL_OO(const Type, t, = array_base(base)); const m_uint depth = base->array_depth - 1; return depth ? array_type(env, t, depth) : t; } ANN static m_bool do_stmt_each(const Env env, const Stmt_Each stmt) { - DECL_OB(const Type, base, = foreach_type(env, stmt->exp)) + DECL_OB(const Type, base, = foreach_type(env, stmt->exp)); CHECK_BB(ensure_traverse(env, base)); const m_str basename = type2str(env->gwion, base, stmt->exp->pos); char c[15 + strlen(basename)]; @@ -1120,7 +1120,7 @@ ANN static m_bool check_stmt_return(const Env env, const Stmt_Exp stmt) { ERR_B(stmt_self(stmt)->pos, _("'return' statement found outside function definition")) if(env->scope->depth == 1) // so ops no dot set scope->depth ? set_fflag(env->func, fflag_return); - DECL_OB(const Type, ret_type, = stmt->val ? check_exp(env, stmt->val) : env->gwion->type[et_void]) + DECL_OB(const Type, ret_type, = stmt->val ? check_exp(env, stmt->val) : env->gwion->type[et_void]); if(!env->func->def->base->ret_type) { assert(isa(env->func->value_ref->type, env->gwion->type[et_lambda]) > 0); env->func->def->base->ret_type = ret_type; @@ -1450,7 +1450,7 @@ ANN m_bool check_func_def(const Env env, const Func_Def f) { return GW_OK; Value override = NULL; CHECK_BB(check_func_def_override(env, fdef, &override)); - DECL_BB(const m_int, scope, = GET_FLAG(fdef->base, global) ? env_push_global(env) : env->scope->depth) + DECL_BB(const m_int, scope, = GET_FLAG(fdef->base, global) ? env_push_global(env) : env->scope->depth); const Func former = env->func; env->func = func; ++env->scope->depth; diff --git a/src/parse/func_resolve_tmpl.c b/src/parse/func_resolve_tmpl.c index 34e976ba..e638ac64 100644 --- a/src/parse/func_resolve_tmpl.c +++ b/src/parse/func_resolve_tmpl.c @@ -147,7 +147,7 @@ ANN static Func find_tmpl(const Env env, const Value v, Exp_Call *const exp, con } ANN static Func _find_template_match(const Env env, const Value v, Exp_Call *const exp) { - DECL_OO(const m_str, tmpl_name, = tl2str(env->gwion, exp->tmpl->call, exp->func->pos)) + DECL_OO(const m_str, tmpl_name, = tl2str(env->gwion, exp->tmpl->call, exp->func->pos)); const Func f = find_tmpl(env, v, exp, tmpl_name); free_mstr(env->gwion->mp, tmpl_name); return f; diff --git a/src/parse/operator.c b/src/parse/operator.c index 05adbdd0..cf7e7afb 100644 --- a/src/parse/operator.c +++ b/src/parse/operator.c @@ -205,7 +205,7 @@ for(int i = 0; i < 2; ++i) { ANN m_bool operator_set_func(const struct Op_Import* opi) { const Nspc nspc = ((Func)opi->data)->value_ref->from->owner; const Vector v = (Vector)map_get(&nspc->info->op_map, (vtype)opi->op); - DECL_OB(M_Operator*, mo, = operator_find(v, opi->lhs, opi->rhs)) + DECL_OB(M_Operator*, mo, = operator_find(v, opi->lhs, opi->rhs)); mo->func = (Func)opi->data; return GW_OK; } diff --git a/src/parse/scan0.c b/src/parse/scan0.c index 10efab95..92fbb9a9 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -149,7 +149,7 @@ ANN static void typedef_fptr(const Env env, const Type_Def tdef, const Type base ANN m_bool scan0_type_def(const Env env, const Type_Def tdef) { CHECK_BB(env_access(env, tdef->ext->flag, tdef->ext->pos)); - DECL_OB(const Type, base, = tdef->tmpl ? find_type(env, tdef->ext) : known_type(env, tdef->ext)) + DECL_OB(const Type, base, = tdef->tmpl ? find_type(env, tdef->ext) : known_type(env, tdef->ext)); CHECK_BB(scan0_defined(env, tdef->xid, tdef->ext->pos)); const bool global = GET_FLAG(tdef->ext, global); // TODO: handle global in class if(global) { @@ -286,7 +286,7 @@ ANN static void cdef_flag(const Class_Def cdef, const Type t) { } ANN static Type get_parent_base(const Env env, Type_Decl *td) { - DECL_OO(const Type, t, = find_type(env, td)) + DECL_OO(const Type, t, = find_type(env, td)); Type owner = env->class_def; while(owner) { if(t == owner) @@ -297,7 +297,7 @@ ANN static Type get_parent_base(const Env env, Type_Decl *td) { } ANN static inline Type scan0_final(const Env env, Type_Decl *td) { - DECL_OO(const Type, t, = known_type(env, td)) + DECL_OO(const Type, t, = known_type(env, td)); if(!GET_FLAG(t, final)) return t; ERR_O(td->pos, _("can't inherit from final parent class '%s'\n."), t->name); @@ -353,7 +353,7 @@ ANN static m_bool scan0_stmt_list(const Env env, Stmt_List list) { #define scan0_func_def dummy_func ANN static m_bool scan0_extend_def(const Env env, const Extend_Def xdef) { - DECL_OB(const Type, t, = known_type(env, xdef->td)) + DECL_OB(const Type, t, = known_type(env, xdef->td)); if(isa(t, env->gwion->type[et_compound]) < 0) ERR_B(xdef->td->pos, _("only compound types can be extended")) if(GET_FLAG(t, final)) // TODO: add type initial declaration diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 26368fde..3eda9547 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -32,7 +32,7 @@ ANN static inline m_bool ensure_scan1(const Env env, const Type t) { } ANN static Type scan1_type(const Env env, Type_Decl* td) { - DECL_OO(const Type, t, = known_type(env, td)) + DECL_OO(const Type, t, = known_type(env, td)); if(!env->func && env->class_def && !GET_FLAG(td, late)) CHECK_BO(type_cyclic(env, t, td)); CHECK_BO(ensure_scan1(env, t)); @@ -40,7 +40,7 @@ ANN static Type scan1_type(const Env env, Type_Decl* td) { } ANN static Type void_type(const Env env, Type_Decl* td) { - DECL_OO(const Type, type, = scan1_type(env, td)) + DECL_OO(const Type, type, = scan1_type(env, td)); if(type->size) return type; ERR_O(td->pos, _("cannot declare variables of size '0' (i.e. 'void')...")) @@ -49,7 +49,7 @@ ANN static Type void_type(const Env env, Type_Decl* td) { ANN static Type scan1_exp_decl_type(const Env env, Exp_Decl* decl) { if(decl->type) return decl->type; - DECL_OO(const Type ,t, = void_type(env, decl->td)) + DECL_OO(const Type ,t, = void_type(env, decl->td)); if(decl->td->xid == insert_symbol("auto") && decl->type) return decl->type; if(GET_FLAG(t, private) && t->info->value->from->owner != env->curr) @@ -429,7 +429,7 @@ ANN static inline m_bool scan1_union_def_inner_loop(const Env env, Union_Def ude nspc_add_value_front(env->curr, insert_symbol("@index"), v); valuefrom(env, v->from, udef->pos); do { - DECL_OB(const Type, t, = known_type(env, l->td)) + DECL_OB(const Type, t, = known_type(env, l->td)); if(nspc_lookup_value0(env->curr, l->xid)) ERR_B(l->pos, _("'%s' already declared in union"), s_name(l->xid)) const Value v = new_value(env->gwion->mp, t, s_name(l->xid)); @@ -631,7 +631,7 @@ ANN static m_bool scan1_parent(const Env env, const Class_Def cdef) { const loc_t pos = cdef->base.ext->pos; if(cdef->base.ext->array && cdef->base.ext->array->exp) CHECK_BB(scan1_exp(env, cdef->base.ext->array->exp)); - DECL_OB(const Type , parent, = scan1_get_parent(env, &cdef->base)) + DECL_OB(const Type , parent, = scan1_get_parent(env, &cdef->base)); if(isa(parent, env->gwion->type[et_object]) < 0) ERR_B(pos, _("cannot extend primitive type '%s'"), parent->name) CHECK_BB(ensure_scan1(env, parent)); diff --git a/src/parse/scanx.c b/src/parse/scanx.c index 0264ed1e..90c0ff8e 100644 --- a/src/parse/scanx.c +++ b/src/parse/scanx.c @@ -21,7 +21,7 @@ ANN static inline m_bool tmpl_push(const Env env, const Tmpl* tmpl) { } ANN static inline m_int _push(const Env env, const Class_Def c) { - DECL_BB(const m_int, scope, = env_push_type(env, c->base.type)) + DECL_BB(const m_int, scope, = env_push_type(env, c->base.type)); return (!c->base.tmpl || tmpl_push(env, c->base.tmpl)) ? scope : GW_ERROR; } @@ -35,7 +35,7 @@ ANN static inline void _pop(const Env e, const Class_Def c, const m_uint s) { // TODO: 'v' should be 2° argument ANN m_bool scanx_body(const Env e, const Class_Def c, const _exp_func f, void* d) { - DECL_BB(const m_int, scope, = _push(e, c)) + DECL_BB(const m_int, scope, = _push(e, c)); const m_bool ret = _body(d, c->body, f); _pop(e, c, scope); return ret; diff --git a/src/parse/template.c b/src/parse/template.c index c0830c18..40144b5e 100644 --- a/src/parse/template.c +++ b/src/parse/template.c @@ -54,7 +54,7 @@ ANN Tmpl* mk_tmpl(const Env env, const Tmpl *tm, const Type_List types) { } static ANN Type scan_func(const Env env, const Type t, const Type_Decl* td) { - DECL_OO(const m_str, tl_name, = tl2str(env->gwion, td->types, td->pos)) + DECL_OO(const m_str, tl_name, = tl2str(env->gwion, td->types, td->pos)); const Symbol sym = func_symbol(env, t->info->value->from->owner->name, t->info->func->name, tl_name, 0); free_mstr(env->gwion->mp, tl_name); const Type base_type = nspc_lookup_type1(t->info->value->from->owner, sym); diff --git a/src/parse/type_decl.c b/src/parse/type_decl.c index c9617e3e..92f9be01 100644 --- a/src/parse/type_decl.c +++ b/src/parse/type_decl.c @@ -33,11 +33,11 @@ ANN static Type resolve(const Env env, Type_Decl* td) { while(last->next) last = last->next; Array_Sub array = last->array; - DECL_OO(const Type, base, = find_type(env, td)) + DECL_OO(const Type, base, = find_type(env, td)); const Context ctx = base->info->value->from->ctx; if(ctx && ctx->error) ERR_O(td->pos, _("type '%s' is invalid"), base->name) - DECL_OO(const Type, type, = scan_type(env, base, td)) + DECL_OO(const Type, type, = scan_type(env, base, td)); const Type t = !td->ref ? type : ref(env, td); const Type ret = !td->option ? t : option(env, td); return !array ? ret: array_type(env, ret, array->depth); diff --git a/src/vm/gack.c b/src/vm/gack.c index 3cbe9fe6..932357ba 100644 --- a/src/vm/gack.c +++ b/src/vm/gack.c @@ -23,7 +23,7 @@ ANN2(1) static int fmtlen(const char *fmt, va_list args) { ANN2(2) static int gw_vasprintf(MemPool mp, char **str, const char *fmt, va_list args) { char *base = *str; const size_t base_len = base ? strlen(base) : 0; - DECL_BB(const int, size, = fmtlen(fmt, args)) + DECL_BB(const int, size, = fmtlen(fmt, args)); char *ret = mp_malloc2(mp, base_len + size + 1); if(base) strcpy(ret, base); diff --git a/tests/module/get_module.c b/tests/module/get_module.c index b57af46a..f6b41695 100644 --- a/tests/module/get_module.c +++ b/tests/module/get_module.c @@ -24,7 +24,7 @@ GWMODEND(get_module) { GWION_IMPORT(dummy_module) { set_module(gwi->gwion, "get_module", (void*)1); - CHECK_OB(get_module(gwi->gwion, "get_module")) + GWI_OB(get_module(gwi->gwion, "get_module")) puts("test passed"); get_module(gwi->gwion, "non_existant_module"); return GW_OK; diff --git a/tests/plug/compile_file.c b/tests/plug/compile_file.c index e2bd0cc5..cc821ee7 100644 --- a/tests/plug/compile_file.c +++ b/tests/plug/compile_file.c @@ -13,7 +13,7 @@ #define _XOPEN_SOURCE 500 #include GWION_IMPORT(compile_string) { - DECL_OB(FILE *,file, = fopen("rm_me.gw", "w+")) + DECL_OB(FILE *,file, = fopen("rm_me.gw", "w+")); fprintf(file, "1;"); rewind(file); const m_bool ret = compile_file(gwi->gwion, __FILE__, file) ? diff --git a/tests/plug/invalid_names.c b/tests/plug/invalid_names.c index 6c70861e..1ace8d46 100644 --- a/tests/plug/invalid_names.c +++ b/tests/plug/invalid_names.c @@ -13,7 +13,7 @@ #include "gwi.h" GWION_IMPORT(trig) { - DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T~", SZ_INT, NULL)) + DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T~", SZ_INT, NULL)); gwi_add_type(gwi, t0); const Type t1 = gwi_mk_type(gwi, "T,", SZ_INT, NULL); diff --git a/tests/plug/invalid_names0.c b/tests/plug/invalid_names0.c index c214155a..bfa055fa 100644 --- a/tests/plug/invalid_names0.c +++ b/tests/plug/invalid_names0.c @@ -13,7 +13,7 @@ #include "gwi.h" GWION_IMPORT(trig) { - DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T~", SZ_INT, NULL)) + DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T~", SZ_INT, NULL)); gwi_add_type(gwi, t0); return GW_OK; } diff --git a/tests/plug/invalid_names1.c b/tests/plug/invalid_names1.c index 64b32cf9..5874a5d2 100644 --- a/tests/plug/invalid_names1.c +++ b/tests/plug/invalid_names1.c @@ -13,7 +13,7 @@ #include "gwi.h" GWION_IMPORT(trig) { - DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T,", SZ_INT, NULL)) + DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T,", SZ_INT, NULL)); gwi_add_type(gwi, t0); return GW_OK; } diff --git a/tests/plug/invalid_names2.c b/tests/plug/invalid_names2.c index 0bf6f62b..a7cd0f9c 100644 --- a/tests/plug/invalid_names2.c +++ b/tests/plug/invalid_names2.c @@ -13,7 +13,7 @@ #include "gwi.h" GWION_IMPORT(trig) { - DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T", SZ_INT, NULL)) + DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T", SZ_INT, NULL)); gwi_add_type(gwi, t0); return GW_OK; } diff --git a/tests/plug/invalid_names3.c b/tests/plug/invalid_names3.c index 1b58601e..02db5306 100644 --- a/tests/plug/invalid_names3.c +++ b/tests/plug/invalid_names3.c @@ -13,7 +13,7 @@ #include "gwi.h" GWION_IMPORT(trig) { - DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T:[a]", SZ_INT, NULL)) + DECL_OB(const Type, t0, = gwi_mk_type(gwi, "T:[a]", SZ_INT, NULL)); gwi_add_type(gwi, t0); return GW_OK; }