-Subproject commit ae1bfee327f32a22d07903b434ce18b138870dee
+Subproject commit 7971b912bbdd6271afd1df5aa8e218b5284d6a44
--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);
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);
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);
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]);
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;
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)));
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;
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)
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)
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)