ANN static Type no_xid(const Env env, const Exp_Decl *decl) {
CHECK_OO((((Exp_Decl*)decl)->type = check_td(env, decl->td)))
- clear_decl(env, decl);
+// clear_decl(env, decl);
CHECK_BO(traverse_exp(env, exp_self(decl)))
return decl->type;
}
if(!decl->td->xid)
return no_xid(env, decl);
if(decl->td->xid == insert_symbol("auto")) { // should be better
- clear_decl(env, decl);
SET_FLAG(decl->td, ref);
CHECK_BO(scan1_exp(env, exp_self(decl)))
CHECK_BO(scan2_exp(env, exp_self(decl)))
}
static inline m_bool scan1_defined(const Env env, const Var_Decl var) {
+ if(var->value) // from a `typeof` declaration
+ return GW_OK;
if(((!env->class_def || env->scope->depth) ? nspc_lookup_value1 : nspc_lookup_value2)(env->curr, var->xid))
ERR_B(var->pos, _("variable %s has already been defined in the same scope..."),
s_name(var->xid))
else
ERR_B(exp_self(decl)->pos, _("Type '%s' is abstract, declare as ref. (use @)"), t->name)
}
- const Value v = var->value = new_value(env->gwion->mp, t, s_name(var->xid));
+ const Value v = var->value = var->value ?: new_value(env->gwion->mp, t, s_name(var->xid));
if(SAFE_FLAG(env->class_def, struct) && !GET_FLAG(decl->td, static)) {
v->from->offset = env->class_def->size;
env->class_def->size += t->size;