-Subproject commit 1f57eb48c6eb8b0379b3d232cb7f3fe1ccf90d67
+Subproject commit 76ba56280e16bbef295c8496a50d079cce7fa1f9
second => now;
var string s;
<<< "test spork exp." >>>;
- } @=> ref Shred shred;
+ } @=> var Shred shred;
}
var C c;
-"test" => ref string s;
+"test" @=> var string s;
<<< s >>>;
var C c;
var C.D d;
-ref C.D d_ref;
+late C.D d_ref;
<<< c, " ", d, d_ref >>>;
}
class C {
- ref Object ref_object;
+ late Object ref_object;
}
#!! assign object to C.ref
var string s;
<<< this, " test spork exp. " , s >>>;
- } @=> ref Shred shred;
+ } @=> var Shred shred;
}
var C c;
ANN static inline void set_decl_ref(const Exp e) {
if(e->exp_type == ae_exp_decl) {
- SET_FLAG(e->d.exp_decl.td, ref);
- SET_FLAG(e->d.exp_decl.list->self->value, ref);
+ SET_FLAG(e->d.exp_decl.td, late);
+ SET_FLAG(e->d.exp_decl.list->self->value, late);
}
}
ANN2(1) static void emit_exp_addref1(const Emitter emit, /* const */Exp exp, m_int size) {
if(isa(exp->info->type, emit->gwion->type[et_object]) > 0 &&
(exp->info->cast_to ? isa(exp->info->cast_to, emit->gwion->type[et_object]) > 0 : 1)) {
- if(exp->exp_type == ae_exp_decl && GET_FLAG(exp->d.exp_decl.td, ref) && !exp_getvar(exp)) {
+ if(exp->exp_type == ae_exp_decl && GET_FLAG(exp->d.exp_decl.td, late) && !exp_getvar(exp)) {
const Instr instr = emit_add_instr(emit, GWOP_EXCEPT);
instr->m_val = size;
}
if(!vflag(v, vflag_member)) {
v->from->offset = emit_local(emit, type);
exec = (f_instr*)(allocword);
- if(GET_FLAG(decl->td, ref)) { // ref or emit_var ?
+ if(GET_FLAG(decl->td, late)) { // ref or emit_var ?
const Instr clean = emit_add_instr(emit, MemSetImm);
clean->m_val = v->from->offset;
}
ANN static m_bool emit_decl(const Emitter emit, const Exp_Decl* decl) {
const m_bool global = GET_FLAG(decl->td, global);
const uint var = exp_getvar(exp_self(decl));
- const uint ref = GET_FLAG(decl->td, ref) || type_ref(decl->type);
+ const uint ref = GET_FLAG(decl->td, late) || type_ref(decl->type);
Var_Decl_List list = decl->list;
do {
if(GET_FLAG(decl->td, static))
ERR_N(exp_self(bin)->pos, _("array depths do not match."))
}
if(bin->rhs->exp_type == ae_exp_decl) {
- SET_FLAG(bin->rhs->d.exp_decl.td, ref);
+ SET_FLAG(bin->rhs->d.exp_decl.td, late);// ???
if(bin->rhs->d.exp_decl.list->self->array &&
bin->rhs->d.exp_decl.list->self->array->exp)
ERR_N(exp_self(bin)->pos, _("do not provide array for 'xxx @=> declaration'."))
if(opck_rassign(env, data, mut) == env->gwion->type[et_error])
return env->gwion->type[et_error];
if(bin->rhs->exp_type == ae_exp_decl)
- SET_FLAG(bin->rhs->d.exp_decl.td, ref);
+ SET_FLAG(bin->rhs->d.exp_decl.td, late); // ???
exp_setvar(bin->rhs, 1);
CHECK_BO(isa(bin->lhs->info->type , bin->rhs->info->type))
return bin->rhs->info->type;
const Instr instr = emit_add_instr(emit, RegPushImm);
instr->m_val = (m_uint)value->type;
}
- if(GET_FLAG(value, ref)) {
+ if(GET_FLAG(value, late)) {
const Instr instr = emit_add_instr(emit, GWOP_EXCEPT);
instr->m_val = -SZ_INT;
}
OP_CHECK(opck_new) {
const Exp_Unary* unary = (Exp_Unary*)data;
- SET_FLAG(unary->td, ref);
+ SET_FLAG(unary->td, late);
DECL_ON(const Type, t, = check_new_td(env, unary->td))
if(isa(t, env->gwion->type[et_object]) < 0)
ERR_N(exp_self(unary)->pos, _("can't use 'new' on non-object types...\n"))
ERR_N(td_pos(unary->td), _("can't use 'new' on ref type '%s'\n"), t->name)
if(GET_FLAG(t, abstract))
ERR_N(td_pos(unary->td), _("can't use 'new' on abstract type '%s'\n"), t->name)
- UNSET_FLAG(unary->td, ref);
+ UNSET_FLAG(unary->td, late);
if(unary->td->array)
CHECK_BN(check_subscripts(env, unary->td->array, 1))
return t;
OP_EMIT(opem_new) {
const Exp_Unary* unary = (Exp_Unary*)data;
CHECK_BO(emit_instantiate_object(emit, exp_self(unary)->info->type,
- unary->td->array, GET_FLAG(unary->td, ref)))
+ unary->td->array, GET_FLAG(unary->td, late)))
return emit_gc(emit, -SZ_INT);
}
ANN static void set_late(const Gwion gwion, const Exp_Decl *decl, const Value v) {
if(!exp_getvar(exp_self(decl)) &&
- (GET_FLAG(decl->td, ref) || is_fptr(gwion, v->type))) {
- SET_FLAG(decl->td, ref);
- SET_FLAG(v, ref);
+ (GET_FLAG(decl->td, late) || is_fptr(gwion, v->type))) {
+ SET_FLAG(decl->td, late);
+ SET_FLAG(v, late);
} else
- UNSET_FLAG(v, ref);
+ UNSET_FLAG(v, late);
}
ANN static m_bool check_decl(const Env env, const Exp_Decl *decl) {
if(!decl->td->xid)
return no_xid(env, decl);
if(decl->td->xid == insert_symbol("auto")) { // should be better
- SET_FLAG(decl->td, ref);
+ SET_FLAG(decl->td, late);
CHECK_BO(scan1_exp(env, exp_self(decl)))
CHECK_BO(scan2_exp(env, exp_self(decl)))
}
ANN static Type scan1_type(const Env env, Type_Decl* td) {
DECL_OO(const Type, type, = known_type(env, td))
const Type t = get_type(type);
- if(!env->func && env->class_def && !GET_FLAG(td, ref))
+ if(!env->func && env->class_def && !GET_FLAG(td, late))
CHECK_BO(type_cyclic(env, t, td))
CHECK_BO(ensure_scan1(env, t))
return type;
if(var->array->exp)
CHECK_BB(scan1_exp(env, var->array->exp))
t = array_type(env, decl->type, var->array->depth);
- } else if(GET_FLAG(t, abstract) && !GET_FLAG(decl->td, ref)) {
+ } else if(GET_FLAG(t, abstract) && !GET_FLAG(decl->td, late)) {
if(!(t == env->class_def && env->scope->depth)) {
if(decl->td->xid == insert_symbol("auto"))
- SET_FLAG(decl->td, ref);
+ SET_FLAG(decl->td, late);
else
ERR_B(exp_self(decl)->pos, _("Type '%s' is abstract, declare as ref. (use @)"), t->name)
}
v->flag |= decl->td->flag;
v->type = t;
if(array_ref(var->array))
- SET_FLAG(decl->td, ref);
+ SET_FLAG(decl->td, late);
if(env->class_def) {
if(env->class_def->info->tuple)
tuple_contains(env, v);
CHECK_BB(env_storage(env, decl->td->flag, exp_self(decl)->pos))
((Exp_Decl*)decl)->type = scan1_exp_decl_type(env, (Exp_Decl*)decl);
if(array_ref(decl->td->array))
- SET_FLAG(decl->td, ref);
+ SET_FLAG(decl->td, late);
CHECK_OB(decl->type)
const m_bool global = GET_FLAG(decl->td, global);
if(global) {
-"lol" @=> ref string s;
+"lol" @=> var string s;
"test" => s;
<<< "testmem".replace(2, 3, "UKUH") >>>;
-ref Gain g => dac;
+late Gain g => dac;
12::samp => now;
me.test_cancel();
<<< "stop" >>>;
-} @=> ref Fork f;
+} @=> var Fork f;
1 => f.set_cancel;
2::samp => now;
return 12;
}
-fork test() @=> ref auto sh;
+fork test() @=> var auto sh;
<<< typeof(sh) >>>;
sh.ev => now;
<<< sh.retval >>>;
-fork { <<< __func__ >>>; } @=> ref Fork f;
+fork { <<< __func__ >>>; } @=> var Fork f;
second => now;
f.join();
-fork { <<< __func__ >>>; minute => now; } @=> ref Fork f;
+fork { <<< __func__ >>>; minute => now; } @=> var Fork f;
f.join();
fun void test(...) {
<<< vararg >>>;
- <<< vararg.cpy() @=> ref Vararg new_arg >>>;
+ <<< vararg.cpy() @=> var Vararg new_arg >>>;
}
test(1);
class C {
- ref Object i, a;
+ late Object i, a;
}
class C {
- ref Object o;
+ late Object o;
}
-ref Object i, a;
+late Object i, a;
<<< i, a >>>;
new Object @=> var Object refref;
new Event;
var Event ev;
-ev @=> ref Event e;
+ev @=> var Event e;
new Event @=> e;
ev @=> e;
var Event e;
spork { e => now; };
spork { samp => now; 4::samp => now;};
-spork { 5::samp => now;} @=> ref Shred s;
-spork { samp => now; 4::samp => now; } @=> ref Shred t;
+spork { 5::samp => now;} @=> var Shred s;
+spork { samp => now; 4::samp => now; } @=> var Shred t;
spork { 2::samp => now; me.exit(); };
spork { new Object; <<< "garbage collect me" >>>; 3::samp => now; };
2::samp => now;
-ref Object o;
+late Object o;
<<< o >>>;