Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Function::ParamInfo::GetNameId #4434

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions toolchain/sem_ir/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@ auto Function::GetParamFromParamRefId(const File& sem_ir, InstId param_ref_id)
return {param_ref_id, ref.As<Param>(), bind_name};
}

auto Function::ParamInfo::GetNameId(const File& sem_ir) -> NameId {
if (bind_name) {
return sem_ir.entity_names().Get(bind_name->entity_name_id).name_id;
} else {
return NameId::Invalid;
}
}

auto Function::GetDeclaredReturnType(const File& file,
SpecificId specific_id) const -> TypeId {
if (!return_storage_id.is_valid()) {
Expand Down
10 changes: 2 additions & 8 deletions toolchain/sem_ir/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,8 @@ struct Function : public EntityWithParamsBase,
InstId param_pattern_id)
-> ParamPatternInfo;

// Equivalent to
// GetParamPatternInfoFromPatternId(sem_ir, param_pattern_id)
// .GetNameId(sem_ir)
// but works even if there is no such ParamPattern inst, e.g. because
// it's been replaced with BuiltinError.
// Gets the name from the name binding instruction, or invalid if this pattern
// has been replaced with BuiltinError.
static auto GetNameFromPatternId(const File& sem_ir, InstId param_pattern_id)
-> SemIR::NameId;

Expand All @@ -95,9 +92,6 @@ struct Function : public EntityWithParamsBase,
InstId inst_id;
Param inst;
std::optional<AnyBindName> bind_name;

// Gets the name from `bind_name`. Returns invalid if that is not present.
auto GetNameId(const File& sem_ir) -> NameId;
};
static auto GetParamFromParamRefId(const File& sem_ir, InstId param_ref_id)
-> ParamInfo;
Expand Down
Loading