var Object i[4];
-foreach(a: i)
+for(a: i)
<<< a >>>;
break;
case eSetCode:
gw_out("{Y}┃{0}{-}% 4lu{0}: SetCode ", j);
+ gw_out(" {-R}%-14"INT_F"{0}", instr->m_val);
+ gw_out(" {-M}%-14"INT_F"{0}", instr->m_val2);
gw_out("\n");
break;
case eRegMove:
CastF2I
Time_Advance
Recurs
-SetCode
+SetCode~i~i
RegMove~i
Reg2Mem~u~i
Reg2Mem4~u~u
}
return GW_OK;
}
-// if (!strncmp(v->type->name, "Ref:[", 5) && (!prim_exp(data)->cast_to || strncmp(prim_exp(data)->cast_to->name, "Ref:[", 5))) {
if (tflag(v->type, tflag_ref) && !safe_tflag(prim_exp(data)->cast_to, tflag_ref)) {
if (exp_getvar(exp_self(prim_self(data)))) {
const Instr instr = emit_add_instr(emit, RegPushMem);
return GW_OK;
}
-ANN static m_bool decl_static(const Emitter emit, const Exp_Decl *decl,
+ANN static m_bool _decl_static(const Emitter emit, const Exp_Decl *decl,
const Var_Decl var_decl, const uint is_ref) {
const Value v = var_decl->value;
- Code * code = emit->code;
- emit->code = (Code *)vector_back(&emit->stack);
CHECK_BB(
emit_instantiate_decl(emit, v->type, decl->td, var_decl->array, is_ref));
CHECK_BB(emit_dot_static_data(emit, v, 1));
// if(get_depth(var_decl->value->type) && !is_ref)
// (void)emit_object_addref(emit, -SZ_INT, 0);
regpop(emit, SZ_INT);
- emit->code = code;
return GW_OK;
}
+ANN static m_bool decl_static(const Emitter emit, const Exp_Decl *decl,
+ const Var_Decl var_decl, const uint is_ref) {
+ Code *const code = emit->code;
+ emit->code = (Code *)vector_back(&emit->stack);
+ const m_bool ret = _decl_static(emit, decl, var_decl, is_ref);
+ emit->code = code;
+ return ret;
+}
+
ANN static inline int struct_ctor(const Value v) {
return tflag(v->type, tflag_struct) && v->type->nspc->pre_ctor;
}
if (!env->class_def)
ERR_O(exp_self(prim)->pos,
_("keyword 'this' can be used only inside class definition..."))
- if (env->func && !vflag(env->func->value_ref, vflag_member))
- ERR_O(exp_self(prim)->pos,
+ if(env->func) {
+ if (!vflag(env->func->value_ref, vflag_member))
+ ERR_O(exp_self(prim)->pos,
_("keyword 'this' cannot be used inside static functions..."))
- if (!exp_getuse(exp_self(prim)) && env->func &&
- !strcmp(s_name(env->func->def->base->xid), "@gack"))
- return get_gack(env->class_def->info->parent); // get_gack ?
+ if (!exp_getuse(exp_self(prim)) &&
+ !strcmp(s_name(env->func->def->base->xid), "@gack"))
+ return get_gack(env->class_def->info->parent); // get_gack ?
+ }
return env->class_def;
}
while (e) {
if (!e->type) // investigate
return NULL;
-// if (!strncmp(e->type->name, "Ref:[", 5)) {
- if (tflag(e->type, tflag_ref)) {
-if(!e->cast_to)e->cast_to = e->type;
+ if (tflag(e->type, tflag_ref) && isa(e->type, e1->type) > 0) {
+ if(!e->cast_to)e->cast_to = e1->type;
}
if (!e1) {
if (fbflag(func->def->base, fbflag_variadic)) return func;
*(m_float *)(reg - SZ_FLOAT) = (m_float) * (m_int *)(reg - SZ_FLOAT);
DISPATCH()
ftoi:
+{
+ const m_float f = * (m_float *)(reg - SZ_FLOAT);
reg -= SZ_FLOAT - SZ_INT;
- *(m_int *)(reg - SZ_INT) = (m_int) * (m_float *)(reg - SZ_INT);
+ *(m_int *)(reg - SZ_INT) = (m_int)f;
DISPATCH()
+}
timeadv:
reg -= SZ_FLOAT;
shredule(s, shred, *(m_float *)(reg - SZ_FLOAT));
const float ii;
123=> var float f;
-foreach(a : [12, 1, 2 ,3].compactMap:[int]( \a {
+for(a : [12, 1, 2 ,3].compactMap:[int]( \a {
var int?i;
145 => i.val;
if(maybe)
i.val++;
return i;
}
-foreach(a : [12, 1, 2 ,3].compactMap:[int](t))
+for(a : [12, 1, 2 ,3].compactMap:[int](t))
<<< "mapped to => ${a}" >>>;
<<< "test" >>>;
fun float t(float i) { return 2; }
-foreach(a : [12., 1, 2 ,3].map:[float](t))
+for(a : [12., 1, 2 ,3].map:[float](t))
<<< "mapped to => ${a}" >>>;
-#!foreach(a : [12, 1, 2 ,3].map:[int](t))
+#!for(a : [12, 1, 2 ,3].map:[int](t))
#! <<< "mapped to => ${a}" >>>;
-#!foreach(a : [12, 1, 2 ,3].map:[int](t))
+#!for(a : [12, 1, 2 ,3].map:[int](t))
#! <<< "mapped to => ${a}" >>>;
-#!foreach(a : [12, 1, 2 ,3].map:[int](t))
+#!for(a : [12, 1, 2 ,3].map:[int](t))
#! <<< "mapped to => ${a}" >>>;
-#!foreach(a : [12, 1, 2 ,3].map:[int]( \a {145 => a;return 2;}))
+#!for(a : [12, 1, 2 ,3].map:[int]( \a {145 => a;return 2;}))
#! <<< "mapped to => ${a}" >>>;
-#!foreach(a : [12, 1, 2 ,3].map:[int]( \a {145 => a;return 2;}))
+#!for(a : [12, 1, 2 ,3].map:[int]( \a {145 => a;return 2;}))
#! <<< "mapped to => ${a}" >>>;
i << 2;
j >> i;
1234 >> i;
-foreach(a : i)
+for(a : i)
<<< a >>>;
#! contains 23
#pragma unroll 2
-foreach(a, i : [ 0, 1, 3 ])
+for(a, i : [ 0, 1, 3 ])
<<< a, i >>>;
#! [contains] b
-foreach(a : [ 'a' : 'c' ])
+for(a : [ 'a' : 'c' ])
<<< a >>>;
#! [contains] \-5
-foreach(a : [ -1 : -6 ])
+for(a : [ -1 : -6 ])
<<< a >>>;
var int i[2][2];
-foreach(a : i)
+for(a : i)
<<< a >>>;
<<< i >>>;
var C i[2];
-foreach(a : i)
+for(a : i)
<<< a >>>;
var int i[4];
-foreach(a : i)
+for(a : i)
<<< 1 => a >>>;
-foreach(a : i)
+for(a : i)
<<< a >>>;
for(var int _i; _i < 1; ++_i);
var int array[2];
array[0];
- foreach(a : array);
+ for(a : array);
repeat(1);
match i,2 {
case 12 when 0:;
typedef int[2] Type;
Type type;
<<<type>>>;
-foreach(ref a : type);
+for(ref a : type);
typedef int[2] Type;
var Type type;
-foreach(a : type);
+for(a : type);