AST: Combine various ownership TypeReprs into one OwnershipTypeRepr.

This lets us consolidate code paths that mostly run in parallel over the
existing InOutTypeRepr/SharedTypeRepr/OwnedTypeRepr family of types. This
patch by itself is NFC but makes it easier to introduce new spellings,
particularly the newly-official `borrowing` and `consuming` modifiers
that were approved in SE-0377.
This commit is contained in:
Joe Groff
2023-01-17 15:52:39 -08:00
parent 0c23901c70
commit 1311df6544
13 changed files with 121 additions and 177 deletions

View File

@@ -917,8 +917,8 @@ static void addParameters(ArrayRef<Identifier> &ArgNames,
if (auto typeRepr = param->getTypeRepr()) {
SourceRange TypeRange = typeRepr->getSourceRange();
if (auto InOutTyR = dyn_cast_or_null<InOutTypeRepr>(typeRepr))
TypeRange = InOutTyR->getBase()->getSourceRange();
if (auto OwnTyR = dyn_cast_or_null<OwnershipTypeRepr>(typeRepr))
TypeRange = OwnTyR->getBase()->getSourceRange();
if (TypeRange.isInvalid())
continue;