}
ANN2(1,2) Type gwi_mk_type(const Gwi gwi NUSED, const m_str name, const m_uint size, const m_str parent_name) {
- m_uint depth;
- const Type_Decl* td = parent_name ? str2decl(gwi->gwion->env, parent_name, &depth, gwi->loc) : NULL;
+ m_uint depth = 0;
+ Type_Decl* td = parent_name ? str2decl(gwi->gwion->env, parent_name, &depth, gwi->loc) : NULL;
+ if(depth) {
+ free_type_decl(gwi->gwion->mp, td);
+ GWI_ERR_O(_("can't create a type with explicit array parent. use typedef for that"))
+ }
const Type parent = td ? known_type(gwi->gwion->env, td) : NULL;
const Type t = new_type(gwi->gwion->mp, 0, name, parent);
t->size = size;
return arg_list;
}
-ANN Type_Decl* import_td(const Gwi gwi, const m_str name) {
+ANN static Type_Decl* import_td(const Gwi gwi, const m_str name) {
const Env env = gwi->gwion->env;
m_uint array_depth;
DECL_OO(const ID_List, type_path, = str2list(env, name, &array_depth, gwi->loc))
--- /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"
+#include "gwi.h"
+
+MFUN(test_mfun){}
+GWION_IMPORT(begin_class) {
+ Type t_invalid_var_name;
+ GWI_OB((t_invalid_var_name = gwi_mk_type(gwi, "invalid_var_name", SZ_INT, "Object[]")))
+ return GW_OK;
+}