Skip to content

Commit

Permalink
🎨 improve xork
Browse files Browse the repository at this point in the history
  • Loading branch information
fennecdjay committed Feb 27, 2024
1 parent 7172b09 commit 9b44186
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/lib/xork.c
Expand Up @@ -59,7 +59,9 @@ static OP_CHECK(opck_spork) {
}
}
const Func f = env->func;
struct Value_ value = { .type = env->gwion->type[et_function]};
struct ValueFrom_ from;
valuefrom(env, &from);
struct Value_ value = { .type = env->gwion->type[et_function], .from = &from};
if(env->class_def)
set_vflag(&value, vflag_member);
struct Func_Base_ fbase = { .tag=MK_TAG(insert_symbol("in spork"), exp_self(unary)->loc), .values = &upvalues, .fbflag = fbflag_lambda};
Expand Down
18 changes: 9 additions & 9 deletions src/parse/check.c
Expand Up @@ -698,18 +698,18 @@ ANN static void print_current_args(Exp* e) {
gw_err("\n");
}

ANN2(1)
ANN2(1, 2)
static void function_alternative(const Env env, const Type t, Exp* args,
const loc_t loc) {
if (env->context && env->context->error) // needed for ufcs
return;
const bool is_closure = !isa(t, env->gwion->type[et_closure]);
Func f = is_closure
? t->info->func
: closure_def(t)->base->func;
if(!f) return;
gwerr_basic("Argument type mismatch", "call site",
"valid alternatives:", env->name, loc, 0);
const bool is_closure = !isa(t, env->gwion->type[et_closure]);
Func up = is_closure
? t->info->func : closure_def(t)->base->func;
do print_signature(up);
while ((up = up->next));
do print_signature(f);
while ((f = f->next));
if (args)
print_current_args(args);
else
Expand Down Expand Up @@ -1069,7 +1069,7 @@ ANN Type check_exp_call1(const Env env, Exp_Call *const exp) {
if(t) return t;
}
}
function_alternative(env, exp->func->type, exp->args, exp->func->loc);
function_alternative(env, t, exp->args, exp->func->loc);
return NULL;
}

Expand Down

0 comments on commit 9b44186

Please sign in to comment.