ANN2(1) m_int gwi_union_ini(const Gwi gwi, const m_str type, const m_str name) {
CHECK_BB(ck_ini(gwi, ck_udef))
if(name)
- CHECK_OB((gwi->ck->sym = str2sym(gwi, name)))
-// gwi->ck->name = name;
+ CHECK_OB((gwi->ck->xid = str2sym(gwi, name)))
gwi->ck->name = type;
if(type)
CHECK_BB(check_typename_def(gwi, gwi->ck))
udef->flag = flag;
udef->xid = gwi->ck->xid;
udef->type_xid = gwi->ck->sym;
+// udef->xid = gwi->ck->sym;
+// udef->type_xid = gwi->ck->xid;
+printf("%p\n", gwi->ck->xid);
if(gwi->ck->tmpl) {
+if(udef->xid)
+printf("xid %s\n", s_name(udef->xid));
if(udef->xid)
GWI_ERR_O(_("Template union type can't declare instance at declaration"));
udef->tmpl = new_tmpl(gwi->gwion->mp, gwi->ck->tmpl, -1);
free_decl_list(mp, ck->list);
if(ck->tmpl)
free_id_list(mp, ck->tmpl);
+// do we miss ck->td ?
}
#include "gwi.h"
GWION_IMPORT(checker) {
- CHECK_BB(tmpl_valid(gwi, "<l"))
+ CHECK_OB(tmpl_valid(gwi, "<l"))
return GW_OK;
}
#include "instr.h"
GWION_IMPORT(too_many_args) {
- GWI_BB(gwi_func_ini(gwi, "int", "test"))
+ GWI_BB(gwi_func_ini(gwi, "Ptr<~int~>", "test"))
GWI_BB(gwi_func_arg(gwi, "int", "i[][]"))
GWI_BB(gwi_func_arg(gwi, "int", "me"))
GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none))
#include "instr.h"
GWION_IMPORT(too_many_args) {
- GWI_BB(gwi_func_ini(gwi, "int", "test"))
+ GWI_BB(gwi_func_ini(gwi, "Ptr<~int~>", "test<~A~>"))
GWI_BB(gwi_func_ini(gwi, "int", "test"))
GWI_BB(gwi_func_arg(gwi, "int", "i[][]"))
GWI_BB(gwi_func_end(gwi, (f_xfun)1, ae_flag_none))
--- /dev/null
+#include "gwion_util.h"
+#include "gwion_ast.h"
+#include "oo.h"
+#include "vm.h"
+#include "env.h"
+#include "type.h"
+#include "object.h"
+#include "instr.h"
+#include "gwion.h"
+#include "value.h"
+#include "operator.h"
+#include "import.h"
+
+GWION_IMPORT(union_test) {
+ GWI_BB(gwi_union_ini(gwi, "U<~A~>", "Test"))
+ GWI_BB(gwi_union_add(gwi,"float", "f"))
+ GWI_BB(gwi_union_add(gwi,"int", "i"))
+ GWI_BB(gwi_union_add(gwi,"A", "a"))
+ GWI_OB(gwi_union_end(gwi, 0))
+ return GW_OK;
+}