Skip to content

Commit

Permalink
restore some irrelevant stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli committed Dec 3, 2023
1 parent 4e23ef1 commit 104eb7a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/typecheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,7 @@ of types. We cannot use printf() style functions because the arguments can be in
any order.
*/
static noreturn void fail_with_implicit_cast_error(
const Type *from,
const Type *to,
Location location,
const char *template)
Location location, const char *template, const Type *from, const Type *to)
{
assert(template);

Expand Down Expand Up @@ -513,7 +510,7 @@ static bool can_cast_implicitly(const Type *from, const Type *to)
}

static void do_implicit_cast(
ExpressionTypes *types, const Type *to, Location location, const char *errmsg_template)
ExpressionTypes *types, const Type *to, Location location, const char *errormsg_template)
{
assert(!types->implicit_cast_type);
assert(!types->implicit_array_to_pointer_cast);
Expand All @@ -535,9 +532,9 @@ static void do_implicit_cast(
}
types->implicit_string_to_array_cast = true;
}
// Passing in NULL for errh can be used to force a cast to happen.
else if (errmsg_template != NULL && !can_cast_implicitly(from, to))
fail_with_implicit_cast_error(from, to, location, errmsg_template);
// Passing in NULL for errormsg_template can be used to "force" a cast to happen.
else if (errormsg_template != NULL && !can_cast_implicitly(from, to))
fail_with_implicit_cast_error(location, errormsg_template, from, to);

types->implicit_cast_type = to;
types->implicit_array_to_pointer_cast = (from->kind == TYPE_ARRAY && to->kind == TYPE_POINTER);
Expand Down

0 comments on commit 104eb7a

Please sign in to comment.