From: Jérémie Astor Date: Tue, 15 Sep 2020 22:08:43 +0000 (+0200) Subject: :fire: Rename Stmt_Auto to Stmt_Each X-Git-Tag: nightly~1289 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=49e44d9b8ab4a80b6f79b444b128068429e8ea28;p=gwion.git :fire: Rename Stmt_Auto to Stmt_Each --- diff --git a/ast b/ast index ae1bfee3..7971b912 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit ae1bfee327f32a22d07903b434ce18b138870dee +Subproject commit 7971b912bbdd6271afd1df5aa8e218b5284d6a44 diff --git a/src/clean.c b/src/clean.c index 8ab4e504..a3bc2dbf 100644 --- a/src/clean.c +++ b/src/clean.c @@ -166,7 +166,7 @@ ANN static void clean_stmt_for(Clean *a, Stmt_For b) { --a->scope; } -ANN static void clean_stmt_auto(Clean *a, Stmt_Auto b) { +ANN static void clean_stmt_each(Clean *a, Stmt_Each b) { ++a->scope; clean_exp(a, b->exp); clean_stmt(a, b->body); diff --git a/src/compile.c b/src/compile.c index b646f22f..c1147955 100644 --- a/src/compile.c +++ b/src/compile.c @@ -105,11 +105,11 @@ ANN static inline m_bool _check(struct Gwion_* gwion, struct Compiler* c) { gwion->env->name = c->name; for(m_uint i = 0; i < vector_size(&gwion->data->passes->vec); ++i) { const compilation_pass *pass = (compilation_pass*)vector_at(&gwion->data->passes->vec, i); - const m_bool ret = pass[0](gwion->env, c->ast); + m_bool ret = pass[0](gwion->env, c->ast); if(ret < 0) ast_cleaner(gwion, c->ast); if(pass[1]) - CHECK_BB(pass[1](gwion->env, (Ast)(m_uint)ret)) + CHECK_BB(pass[1](gwion->env, &ret)) CHECK_BB(ret) } ast_cleaner(gwion, c->ast); diff --git a/src/emit/emit.c b/src/emit/emit.c index 2cf5df2b..1206f21e 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1522,7 +1522,7 @@ ANN static m_bool emit_stmt_for(const Emitter emit, const Stmt_For stmt) { return ret; } -ANN static Instr emit_stmt_autoptr_init(const Emitter emit, const Type type) { +ANN static Instr emit_stmt_eachptr_init(const Emitter emit, const Type type) { const Instr new_obj = emit_add_instr(emit, ObjectInstantiate); new_obj->m_val2 = (m_uint)type; (void)emit_addref(emit, 0); @@ -1530,9 +1530,9 @@ ANN static Instr emit_stmt_autoptr_init(const Emitter emit, const Type type) { return emit_add_instr(emit, Reg2Mem); } -ANN static m_bool _emit_stmt_auto(const Emitter emit, const Stmt_Auto stmt, m_uint *end_pc) { +ANN static m_bool _emit_stmt_each(const Emitter emit, const Stmt_Each stmt, m_uint *end_pc) { const Instr s1 = emit_add_instr(emit, MemSetImm); - Instr cpy = stmt->is_ptr ? emit_stmt_autoptr_init(emit, stmt->v->type) : NULL; + Instr cpy = stmt->is_ptr ? emit_stmt_eachptr_init(emit, stmt->v->type) : NULL; emit_local(emit, emit->gwion->type[et_int]); const m_uint offset = emit_local(emit, emit->gwion->type[et_int]); emit_local(emit, emit->gwion->type[et_int]); @@ -1554,11 +1554,11 @@ ANN static m_bool _emit_stmt_auto(const Emitter emit, const Stmt_Auto stmt, m_ui return ret; } -ANN static m_bool emit_stmt_auto(const Emitter emit, const Stmt_Auto stmt) { +ANN static m_bool emit_stmt_each(const Emitter emit, const Stmt_Each stmt) { CHECK_BB(emit_exp(emit, stmt->exp)) emit_push_stack(emit); m_uint end_pc = 0; - const m_bool ret = _emit_stmt_auto(emit, stmt, &end_pc); + const m_bool ret = _emit_stmt_each(emit, stmt, &end_pc); emit_pop_stack(emit, end_pc); regpop(emit, SZ_INT); return ret; diff --git a/src/parse/check.c b/src/parse/check.c index d8ceeea9..0a763dfa 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1000,7 +1000,7 @@ ANN static inline m_bool for_empty(const Env env, const Stmt_For stmt) { return GW_OK; } -// the two next function do not account for arrays. (they are only stmt_auto() helpers +// the two next function do not account for arrays. (they are only stmt_each() helpers ANN static Type_Decl* _type2td(const Env env, const Type t, Type_Decl *next) { Type_Decl *td = new_type_decl(env->gwion->mp, insert_symbol(t->name), loc_cpy(env->gwion->mp, td_pos(next))); @@ -1015,7 +1015,7 @@ ANN static Type_Decl* type2td(const Env env, const Type t, const loc_t loc) { return !t->e->owner_class ? td : _type2td(env, t->e->owner_class, td); } -ANN static m_bool do_stmt_auto(const Env env, const Stmt_Auto stmt) { +ANN static m_bool do_stmt_each(const Env env, const Stmt_Each stmt) { DECL_OB(Type, t, = check_exp(env, stmt->exp)) while(GET_FLAG(t, typedef)) t = t->e->parent; @@ -1071,7 +1071,7 @@ stmt_func_xxx(for, Stmt_For,, !( stmt_func_xxx(loop, Stmt_Loop,, !(!check_exp(env, stmt->cond) || cond_type(env, stmt->cond) < 0 || check_conts(env, stmt_self(stmt), stmt->body) < 0) ? 1 : -1) -stmt_func_xxx(auto, Stmt_Auto,, do_stmt_auto(env, stmt)) +stmt_func_xxx(each, Stmt_Each,, do_stmt_each(env, stmt)) ANN static m_bool check_stmt_return(const Env env, const Stmt_Exp stmt) { if(!env->func) diff --git a/src/parse/scan1.c b/src/parse/scan1.c index 143c15f7..c768d62d 100644 --- a/src/parse/scan1.c +++ b/src/parse/scan1.c @@ -293,7 +293,7 @@ describe_ret_nspc(for, Stmt_For,, !(scan1_stmt(env, stmt->c1) < 0 || scan1_stmt(env, stmt->c2) < 0 || (stmt->c3 && scan1_exp(env, stmt->c3) < 0) || scan1_stmt(env, stmt->body) < 0) ? 1 : -1) -describe_ret_nspc(auto, Stmt_Auto,, !(scan1_exp(env, stmt->exp) < 0 || +describe_ret_nspc(each, Stmt_Each,, !(scan1_exp(env, stmt->exp) < 0 || scan1_stmt(env, stmt->body) < 0) ? 1 : -1) describe_ret_nspc(loop, Stmt_Loop,, !(scan1_exp(env, stmt->cond) < 0 || scan1_stmt(env, stmt->body) < 0) ? 1 : -1) diff --git a/src/parse/scan2.c b/src/parse/scan2.c index f0b637a0..82be1bc1 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -213,7 +213,7 @@ scan2_stmt_func(for, Stmt_For,, !(scan2_stmt(env, stmt->c1) < 0 || scan2_stmt(env, stmt->c2) < 0 || (stmt->c3 && scan2_exp(env, stmt->c3) < 0) || scan2_stmt(env, stmt->body) < 0) ? 1 : -1) -scan2_stmt_func(auto, Stmt_Auto,, !(scan2_exp(env, stmt->exp) < 0 || +scan2_stmt_func(each, Stmt_Each,, !(scan2_exp(env, stmt->exp) < 0 || scan2_stmt(env, stmt->body) < 0) ? 1 : -1) scan2_stmt_func(loop, Stmt_Loop,, !(scan2_exp(env, stmt->cond) < 0 || scan2_stmt(env, stmt->body) < 0) ? 1 : -1)