args->next = NULL;
if(tmp) tmp = (tmp->next = cpy_exp(env->gwion->mp, args));
else base = (tmp = cpy_exp(env->gwion->mp, args));
- args->next = next;
- } else {
+ args->next = next;
+ } else {
if(!lhs) {
free_exp(env->gwion->mp, base);
return NULL;
if(!strncmp(bin->rhs->type->name, "partial:", 8)) {
const Stmt stmt = mp_vector_at(bin->rhs->type->info->func->def->d.code->d.stmt_code.stmt_list, struct Stmt_, 0);
const Exp_Call *call = &stmt->d.stmt_exp.val->d.exp_call;
- const Exp args = uncurry(env, bin);
- if(args) return mk_call(env, exp_self(bin), call->func, args);
+ DECL_ON(const Exp, args, = uncurry(env, bin));
+ return mk_call(env, exp_self(bin), call->func, args);
}
return mk_call(env, exp_self(bin), bin->rhs, bin->lhs);
}
const Value v = check_non_res_value(env, data);
if (!v || !vflag(v, vflag_valid) || (v->from->ctx && v->from->ctx->error)) {
const m_str name = s_name(*data);
- if (!isalpha(*name) && *name != '_') { /* && *name != '@' ???*/
+ if (!isalpha(*name) && *name != '_') {
prim_self(data)->value = env->gwion->type[et_op]->info->value;
return env->gwion->type[et_op];
}
if(is_hole(env, e) || is_typed_hole(env, e)) {
char c[256];
sprintf(c, "@%u", i);
- return new_prim_id(env->gwion->mp, insert_symbol(c), e->pos);
+ const Exp exp = new_prim_id(env->gwion->mp, insert_symbol(c), e->pos);
+ exp->type = e->type;
+ exp->d.prim.value = new_value(env, e->type, c, e->pos);
+ valid_value(env, insert_symbol(c), exp->d.prim.value);
+ return exp;
}
const Exp next = e->next;
e->next = NULL;
}
ERR_O(call->func->pos, _("no match found for partial application"));
}
+ nspc_push_value(env->gwion->mp, env->curr);
Func_Base *const fbase = partial_base(env, f->def->base, call->args, call->func->pos);
const Stmt code = partial_code(env, call->func, call->args);
const Exp exp = exp_self(call);
exp->d.exp_lambda.def = new_func_def(env->gwion->mp, fbase, code);
exp->exp_type = ae_exp_lambda;
CHECK_OO(traverse_func_def(env, exp->d.exp_lambda.def));
+ nspc_pop_value(env->gwion->mp, env->curr);
return exp->d.exp_lambda.def->base->func->value_ref->type;
}