CHECK_BB(emit_instantiate_object(emit, v->type, var_decl->array, is_ref))
CHECK_BB(emit_dot_static_data(emit, v, 1))
emit_add_instr(emit, Assign);
+ emit_add_instr(emit, RegAddRef);
+ regpop(emit, SZ_INT);
emit->code = code;
return GW_OK;
}
SET_FLAG(udef->l->self->d.exp_decl.list->self->value, enum);
}
if(udef->xid)
- regpop(emit, !GET_FLAG(udef, static) ? SZ_INT : SZ_INT*2);
+ regpop(emit, SZ_INT);
emit_union_offset(udef->l, udef->o);
if(udef->xid || udef->type_xid || global)
emit_pop(emit, scope);
return env->class_def;
}
+
+ANN static inline Value prim_str_value(const Env env, const Symbol sym) {
+ const Value v = nspc_lookup_value0(env->global_nspc, sym);
+ if(v)
+ return v;
+ const Value value = new_value(env->gwion->mp, t_string, s_name(sym));
+ map_set(&env->global_nspc->info->value->map, (vtype)sym, (vtype)value);
+ return value;
+}
+
ANN static Type prim_str(const Env env, Exp_Primary *const prim) {
if(!prim->value) {
const m_str str = prim->d.str;
- const Value v = new_value(env->gwion->mp, t_string, str);
char c[strlen(str) + 8];
sprintf(c, "%s:string", str);
- nspc_add_value(env_nspc(env), insert_symbol(c), v);
- prim->value = v;
+ prim->value = prim_str_value(env, insert_symbol(c));
}
return t_string;
}