Skip to content

Commit

Permalink
🎨 simplify body ast
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Jun 19, 2023
1 parent b36939f commit a35cfc7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ast
Submodule ast updated 2 files
+11 −42 src/gwion.y
+1,679 −1,753 src/parser.c
10 changes: 9 additions & 1 deletion src/parse/scan0.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,15 @@ ANN static m_bool _scan0_trait_def(const Env env, const Trait_Def pdef) {
ERR_B(fdef->base->pos, "Trait function must be declared without qualifiers");
if (!trait->fun) trait->fun = new_mp_vector(env->gwion->mp, Func_Def, 0);
mp_vector_add(env->gwion->mp, &trait->fun, Func_Def, fdef);
}
} else if (section->section_type == ae_section_stmt) {
Stmt_List list = section->d.stmt_list;
for(uint32_t i = 0; i < list->len; i++) {
Stmt stmt = mp_vector_at(list, struct Stmt_, i);
if(stmt->d.stmt_exp.val->exp_type != ae_exp_decl)
ERR_B(stmt->pos, "trait can only contains variable requests and functions");
}
} else
ERR_B(pdef->pos, "invalid section for trait definition");
}
return GW_OK;
}
Expand Down

0 comments on commit a35cfc7

Please sign in to comment.