--- /dev/null
+int i[2];
+<<< typeof(i) >>>;
+<<< typeof(1) >>>;
}
ANN static m_bool emit_exp_typeof(const Emitter emit, const Exp_Typeof *exp) {
- regpushi(emit, (m_uint)(actual_type(emit->gwion, exp->exp->type)));
+ if(!exp->exp->type->array_depth)
+ regpushi(emit, (m_uint)(actual_type(emit->gwion, exp->exp->type)));
+ else
+ regpushi(emit, (m_uint)exp->exp->type);
return GW_OK;
}
mp_free(((Gwion)gwion)->mp, ArrayInfo, info);
}
+static GACK(gack_array) {
+ printf("%s", t->name);
+}
+
GWION_IMPORT(array) {
const Type t_array = gwi_class_ini(gwi, "@Array", NULL);
gwi->gwion->type[et_array] = t_array;
gwi_class_xtor(gwi, NULL, array_dtor);
-
+ GWI_BB(gwi_gack(gwi, t_array, gack_array))
GWI_BB(gwi_item_ini(gwi, "@internal", "@array"))
GWI_BB(gwi_item_end(gwi, 0, NULL))
#include "gack.h"
ANN void gack(const VM_Shred shred, const Instr instr) {
- Type t = (Type)instr->m_val;
+ Type base = (Type)instr->m_val, t = base;
do {
if(t->e->gack) {
if(GET_FLAG(t->e->gack, builtin))
- ((f_gack)t->e->gack->native_func)(t, (shred->reg - t->size), shred);
+ ((f_gack)t->e->gack->native_func)(base, (shred->reg - t->size), shred);
else {
shred->mem += instr->m_val2;
*(m_uint*)(shred->mem+ SZ_INT) = instr->m_val2 + SZ_INT;
ANN static Type check_exp_typeof(const Env env, const Exp_Typeof *exp) {
DECL_OO(const Type, t, = check_exp(env, exp->exp))
- DECL_OO(Value, v, = nspc_lookup_value1(t->e->owner, insert_symbol(t->name)))
- return v->type;
+ if(!t->array_depth) {
+ DECL_OO(Value, v, = nspc_lookup_value1(t->e->owner, insert_symbol(t->name)))
+ return v->type;
+ }
+ return t;
}
static const _type_func exp_func[] = {