Skip to content

Commit

Permalink
Extract the type from the callee.
Browse files Browse the repository at this point in the history
  • Loading branch information
asoffer committed Dec 30, 2023
1 parent c39050c commit a3dd458
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ir/ir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,9 @@ struct CallArguments {
return InvocationSuccess{};
}

jasmin::InstructionSpecification MakeInstructionSpecification(
type::FunctionType fn_type) const {
jasmin::InstructionSpecification MakeInstructionSpecification() const {
jasmin::InstructionSpecification spec{.parameters = 1, .returns = 0};
auto fn_type = callee.type().AsFunction();
auto iter = (*fn_type.parameters()).begin();
for (size_t i = 0; i < std::distance(postfix_start, arguments.end()); ++i) {
spec.parameters += type::JasminSize(iter->type);
Expand Down Expand Up @@ -863,9 +863,9 @@ void HandleParseTreeNodeCallExpression(ParseNodeIndex index, IrContext& context,
{type::QualifiedType::Unqualified(type::Error)});
return;
}
// TODO: Properly implement function call type-checking.

auto [iter, inserted] = context.emit.instruction_spec.try_emplace(
index, call.MakeInstructionSpecification(fn_type));
index, call.MakeInstructionSpecification());
NTH_REQUIRE((v.harden), inserted);
auto const& returns = fn_type.returns();
std::vector<type::QualifiedType> return_qts;
Expand Down

0 comments on commit a3dd458

Please sign in to comment.