ANN bool gwi_typedef_ini(const Gwi gwi, const restrict m_str type,
const restrict m_str name);
+ANN bool gwi_typedef_exp(const Gwi gwi, const restrict m_str data);
ANN Type gwi_typedef_end(const Gwi gwi, const ae_flag flag);
ANN void ck_clean_tdef(MemPool, ImportCK *);
#include "import.h"
#include "gwi.h"
#include "clean.h"
+#include "gwion_parse.h"
ANN2(1, 2, 3)
static bool dl_func_init(const Gwi gwi, const restrict m_str t,
return false;
}
-ANN bool gwi_func_valid(const Gwi gwi, ImportCK *ck) {
+ANN static bool gwi_func_valid(const Gwi gwi, const f_xfun addr, ImportCK *ck) {
const Func_Def fdef = import_fdef(gwi, ck);
fdef->builtin = true;
if (safe_tflag(gwi->gwion->env->class_def, tflag_tmpl)) {
section_fdef(gwi, fdef);
- fdef->d.dl_func_ptr = ck->addr;
+ fdef->d.dl_func_ptr = addr;
return true;
}
if (!traverse_func_def(gwi->gwion->env, fdef))
return error_fdef(gwi, fdef);
- builtin_func(gwi->gwion, fdef->base->func, ck->addr);
+ builtin_func(gwi->gwion, fdef->base->func, addr);
return true;
}
ANN bool gwi_func_end(const Gwi gwi, const f_xfun addr, const ae_flag flag) {
CHECK_B(ck_ok(gwi, ck_fdef));
- gwi->ck->addr = addr;
gwi->ck->flag = flag;
- const bool ret = gwi_func_valid(gwi, gwi->ck);
+ const bool ret = gwi_func_valid(gwi, addr, gwi->ck);
ck_end(gwi);
return ret;
}
+ANN bool gwi_func_code(const Gwi gwi, const char *data) {
+ Func_Def fdef = gwion_parse_func_def(gwi->gwion, data, gwi->loc);
+ if (safe_tflag(gwi->gwion->env->class_def, tflag_tmpl))
+ return section_fdef(gwi, fdef);
+ if (!traverse_func_def(gwi->gwion->env, fdef))
+ return error_fdef(gwi, fdef);
+ return true;
+}
+
ANN bool gwi_func_arg(const Gwi gwi, const restrict m_str t,
const restrict m_str n) {
CHECK_B(ck_ok(gwi, ck_fdef));
#include "operator.h"
#include "import.h"
#include "gwi.h"
+#include "gwion_parse.h"
ANN bool gwi_typedef_ini(const Gwi gwi, const restrict m_str type,
const restrict m_str name) {
return !!(gwi->ck->td = gwi_str2td(gwi, type));
}
+ANN bool gwi_typedef_exp(const Gwi gwi, const restrict m_str data) {
+ CHECK_B((gwi->ck->when = gwion_parse_expression(gwi->gwion, data, gwi->loc)));
+ return true;
+}
+
ANN Type gwi_typedef_end(const Gwi gwi, const ae_flag flag) {
CHECK_O(ck_ok(gwi, ck_tdef));
Type_Decl *td = gwi->ck->td;
td->flag |= flag;
const Type_Def tdef =
new_type_def(gwi->gwion->mp, td, gwi->ck->sym, gwi->loc);
+ if (gwi->ck->when) tdef->when = gwi->ck->when;
if (gwi->ck->tmpl) tdef->tmpl = gwi_tmpl(gwi);
gwi->ck->td = NULL;
gwi->ck->tmpl = NULL;
ANN void ck_clean_tdef(MemPool mp, ImportCK *ck) {
if (ck->td) free_type_decl(mp, ck->td);
+ if (ck->when) free_exp(mp, ck->when);
if (ck->tmpl) free_id_list(mp, ck->tmpl);
}