-var Object i[4];
+var Object[4] i;
foreach(a: i)
<<< a >>>;
struct TupleForm_ *tuple;
struct VM_Code_ * gack;
ID_List traits;
+ Scope values;
};
enum tflag {
const VM_Code code = finalyze(emit, EOC);
const VM_Shred shred = new_vm_shred(emit->gwion->mp, code);
vm_add_shred(emit->gwion->vm, shred);
- shred->info->me->ref++;
+// shred->info->me->ref++;
vm_run(emit->gwion->vm);
emit->gwion->vm->bbq->is_running = true;
const m_float ret = *(m_float*)shred->reg;
if (stmt->val->exp_type == ae_exp_call && emit->env->func == f)
return optimize_tail_call(emit, &stmt->val->d.exp_call);
}
- if(!stmt->val->ref && isa(stmt->val->type, emit->gwion->type[et_compound]) > 0)
- emit_local(emit, stmt->val->type);
+// if(!stmt->val->ref && isa(stmt->val->type, emit->gwion->type[et_compound]) > 0)
+// emit_local(emit, stmt->val->type);
CHECK_BB(emit_exp(emit, stmt->val));
}
vector_add(&emit->code->stack_return, (vtype)emit_add_instr(emit, Goto));
Upvalues upvalues = {
.values = env->curr->info->value
};
+ if(env->class_def) env->class_def->info->values = env->curr->info->value;
env->curr->info->value = new_scope(env->gwion->mp);
l->def->base->values = &upvalues;
const m_uint scope = env->scope->depth;
return value;
if (env->func && env->func->def->base->values)
return upvalues_lookup(env->func->def->base->values, member->xid);
+ if(t->info->values)
+ return (Value)scope_lookup1(t->info->values, (m_uint)member->xid);
return NULL;
}
Upvalues upvalues = { .values = env->curr->info->value };
if(env->func && env->func->def->base->values)
upvalues.parent = env->func->def->base->values;
+ if(env->class_def) env->class_def->info->values = env->curr->info->value;
env->curr->info->value = new_scope(env->gwion->mp);
if(unary->captures) {
for(uint32_t i = 0; i < unary->captures->len; i++) {
ANN m_bool ensure_traverse(const Env env, const Type t) {
if (tflag(t, tflag_check) || !(tflag(t, tflag_cdef) || tflag(t, tflag_udef)))
return GW_OK;
+ if(!tflag(t, tflag_tmpl)) return GW_OK;
struct EnvSet es = {.env = env,
.data = env,
.func = (_exp_func)traverse_cdef,
.data = (uintptr_t)unary,
.pos = exp_self(unary)->pos};
DECL_OO(const Type, ret, = op_check(env, &opi));
- const Type t = actual_type(env->gwion, ret);
- CHECK_BO(ensure_traverse(env, t));
return ret;
}
}
ANN m_bool check_type_def(const Env env, const Type_Def tdef) {
+ if(tdef->ext->array && tdef->ext->array->exp)
+ CHECK_OB(check_exp(env, tdef->type->info->cdef->base.ext->array->exp));
if (tdef->when) {
set_tflag(tdef->type, tflag_contract);
struct Var_Decl_ decl = { .xid = insert_symbol("self"), .pos = tdef->when->pos };
}
return GW_OK;
}
+
ANN static Type check_exp_lambda(const Env env, const Exp_If *exp_if NUSED) {
return env->gwion->type[et_function];
}
const Func func = new_func(env->gwion->mp, name, f);
if (env->class_def && tflag(env->class_def, tflag_tmpl))
set_fflag(func, fflag_ftmpl);
- if (fbflag(f->base, fbflag_lambda))
+ if (fbflag(f->base, fbflag_lambda)) {
+ if(env->class_def) env->class_def->info->values = env->curr->info->value;
env->curr->info->value = new_scope(env->gwion->mp);
+ }
return func;
}