return type;
}
-ANN2(1,3,4) m_bool check_lambda(const Env env, const Type owner,
- Exp_Lambda *l, const Func_Def def) {
- const m_uint scope = ((l->owner = owner)) ?
- env_push_type(env, owner) : env->scope->depth;
+ANN static m_bool _check_lambda(const Env env, Exp_Lambda *l, const Func_Def def) {
Arg_List base = def->base->args, arg = l->args;
while(base && arg) {
arg->td = base->td;
arg->td = NULL;
arg = arg->next;
}
+ return GW_OK;
+}
+ANN2(1,3,4) m_bool check_lambda(const Env env, const Type owner,
+ Exp_Lambda *l, const Func_Def def) {
+ const m_uint scope = ((l->owner = owner)) ?
+ env_push_type(env, owner) : env->scope->depth;
+ const m_bool ret = _check_lambda(env, l, def);
if(owner)
env_pop(env, scope);
- return GW_OK;
+ return ret;
}
ANN static m_bool fptr_lambda(const Env env, struct FptrInfo *info) {
}
static void member_fptr(const Emitter emit) {
- const Instr instr = emit_add_instr(emit, RegPop);
- instr->m_val = SZ_INT;
- const Instr dup = emit_add_instr(emit, Reg2Reg);
- dup->m_val = -SZ_INT;
+ const Instr instr = emit_add_instr(emit, RegPop);
+ instr->m_val = SZ_INT;
+ const Instr dup = emit_add_instr(emit, Reg2Reg);
+ dup->m_val = -SZ_INT;
}
static OP_EMIT(opem_fptr_cast) {
ERR_O(exp_self(unary)->pos, _("spork/fork must not have next expression"))
if(unary->exp && unary->exp->exp_type == ae_exp_call)
return env->gwion->type[unary->op == insert_symbol("spork") ? et_shred : et_fork];
- else if(unary->code) {
+ if(unary->code) {
++env->scope->depth;
nspc_push_value(env->gwion->mp, env->curr);
const m_bool ret = check_stmt(env, unary->code);
--env->scope->depth;
CHECK_BO(ret)
return env->gwion->type[unary->op == insert_symbol("spork") ? et_shred : et_fork];
- } else
- ERR_O(exp_self(unary)->pos, _("only function calls can be sporked..."))
- return NULL;
+ }
+ ERR_O(exp_self(unary)->pos, _("only function calls can be sporked..."))
}
static OP_EMIT(opem_spork) {
xfree((void*)vector_at(v, i - 1));
free_vector(mp, v);
}
- mp_free(mp, ShredInfo, info); // ??? info->p
+ mp_free(mp, ShredInfo, info);
}
VM_Shred new_vm_shred(MemPool p, VM_Code c) {
const VM_Shred shred = mp_calloc(p, Stack);
- shred->code = c;
- shred->reg = (m_bit*)shred + sizeof(struct VM_Shred_);
+ shred->code = c;
+ shred->reg = (m_bit*)shred + sizeof(struct VM_Shred_);
shred->base = shred->mem = shred->reg + SIZEOF_REG;
shred->info = new_shredinfo(p, c->name);
shred->info->orig = c;
release((M_Object)vector_at(&shred->gc, i - 1), shred);
vector_release(&shred->gc);
REM_REF(shred->info->orig, shred->info->vm->gwion);
- MemPool mp = shred->info->mp;
+ const MemPool mp = shred->info->mp;
mp_free(mp, ShredTick, shred->tick);
free_shredinfo(mp, shred->info);
mp_free(mp, Stack, shred);