mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 06:11:05 +01:00
Refactor function return type representation (#6463)
This separates the return type from the return pattern, and replaces the return pattern with a block of return patterns. This is a step toward support for `ref` returns (where there's no corresponding return pattern) and compund-form returns (where there may be multiple return patterns).
This commit is contained in:
@@ -128,11 +128,11 @@ auto Function::GetParamPatternInfoFromPatternId(const File& sem_ir,
|
||||
|
||||
auto Function::GetDeclaredReturnType(const File& file,
|
||||
SpecificId specific_id) const -> TypeId {
|
||||
if (!return_slot_pattern_id.has_value()) {
|
||||
if (!return_type_inst_id.has_value()) {
|
||||
return TypeId::None;
|
||||
}
|
||||
return ExtractScrutineeType(
|
||||
file, GetTypeOfInstInSpecific(file, specific_id, return_slot_pattern_id));
|
||||
return file.types().GetTypeIdForTypeConstantId(
|
||||
GetConstantValueInSpecific(file, specific_id, return_type_inst_id));
|
||||
}
|
||||
|
||||
} // namespace Carbon::SemIR
|
||||
|
||||
Reference in New Issue
Block a user