From: fennecdjay Date: Mon, 19 Jun 2023 14:05:19 +0000 (+0200) Subject: :art: simplify body ast X-Git-Tag: nightly~141 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=a35cfc797bf931795b1e1963afa93930e5a4f607;p=gwion.git :art: simplify body ast --- diff --git a/ast b/ast index 2d0d0b37..58ede83c 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit 2d0d0b37334ea78006ec17c2af1425e117b544a0 +Subproject commit 58ede83c62af55bec048d0ce99081aa829540612 diff --git a/src/parse/scan0.c b/src/parse/scan0.c index 8d3b37bf..9f8e18b4 100644 --- a/src/parse/scan0.c +++ b/src/parse/scan0.c @@ -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; }