Symbol sym;
union {
ID_List tmpl;
- Type (*ck)(Env, void*, m_bool*); // oper
Exp exp;
};
union {
Symbol xid;// union name
- Instr (*em)(Emitter, void*); // oper
f_xfun addr;
};
union {
Decl_List list;// union
struct Vector_ v;
// ID_List curr;// enum
- m_str lhs;// oper
};
union {
Type_Decl *td; // typedef
ID_List curr;// enum
- m_str rhs;// oper
};
ae_flag flag; // ????
enum importck_type type;
} ImportCK;
typedef struct OperCK { // name_checker ?
- m_str name;
+ m_str ret;
Symbol sym;
Type (*ck)(Env, void*, m_bool*); // oper
Instr (*em)(Emitter, void*); // oper
- union {
- Decl_List list;// union
- struct Vector_ v;
-// ID_List curr;// enum
- m_str lhs;// oper
- };
- union {
- Type_Decl *td; // typedef
- ID_List curr;// enum
- m_str rhs;// oper
- };
- ae_flag flag; // ????
- enum importck_type type;
+ m_str lhs;// oper
+ m_str rhs;// oper
} OperCK;
struct array_checker {
}
ANN Var_Decl_List str2varlist(const Gwi gwi, const m_str path) {
- const Var_Decl var = str2var(gwi, path);
+ DECL_OO(const Var_Decl, var, = str2var(gwi, path))
return new_var_decl_list(gwi->gwion->mp, var, NULL);
}
break;
}
++ck->depth;
- return is_end ? GW_OK : array_check(gwi, ck);
+ return is_end ? GW_OK : _array_check(gwi, ck);
}
if(isdigit(c))
tmp[i] = c;
const f_instr f) {
const Type lhs = get_type(gwi, op->lhs),
rhs = get_type(gwi, op->rhs),
- ret = get_type(gwi, op->name);
+ ret = get_type(gwi, op->ret);
const struct Op_Import opi = { lhs, rhs, ret,
op->ck, op->em, (uintptr_t)f, gwi->loc, op->sym };
return add_op(gwi->gwion, &opi);
ANN2(1) m_int gwi_oper_ini(const Gwi gwi, const restrict m_str l,
const restrict m_str r, const restrict m_str t) {
- gwi->oper->name = t;
+ gwi->oper->ret = t;
gwi->oper->rhs = r;
gwi->oper->lhs = l;
return GW_OK;
ANN Type find_type(const Env env, ID_List path) {
Type type = nspc_lookup_type1(env->curr, path->xid);
+if(!type && env->class_def) {
+ Type base = env->class_def->e->parent;
+ while(base && base->nspc) {
+ if((type = nspc_lookup_type1(base->nspc, path->xid)))
+ break;
+ }
+}
+
CHECK_OO(type)
Nspc nspc = type->nspc;
path = path->next;
#include "gwi.h"
GWION_IMPORT(checker) {
- gwi_item_ini(gwi, "int", "array[]");
+ gwi_item_ini(gwi, "int", "array[2][3]");
return GW_OK;
}
--- /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"
+
+GWION_IMPORT(checker) {
+ GWI_BB(gwi_union_ini(gwi, NULL, NULL))
+ GWI_BB(gwi_union_add(gwi, "int", "|array[2][3]"))
+ return GW_OK;
+}
--- /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(enum_test) {
+ GWI_BB(gwi_enum_add(gwi, "adc", 0))
+ return GW_OK;
+}