Skip to content

Commit 090934f

Browse files
committed
ClangImporter: Remove uses of AbstractFunctionDecl::getParameterLists()
1 parent e1da265 commit 090934f

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ makeIndirectFieldAccessors(ClangImporter::Implementation &Impl,
838838
lhs = new (C) MemberRefExpr(lhs, SourceLoc(), anonymousInnerFieldDecl,
839839
DeclNameLoc(), /*implicit*/true);
840840

841-
auto newValueDecl = setterDecl->getParameterList(1)->get(0);
841+
auto newValueDecl = setterDecl->getParameters()->get(0);
842842

843843
auto rhs = new (C) DeclRefExpr(newValueDecl, DeclNameLoc(),
844844
/*implicit*/ true);
@@ -922,7 +922,7 @@ makeUnionFieldAccessors(ClangImporter::Implementation &Impl,
922922
auto inoutSelf = new (C) InOutExpr(SourceLoc(), inoutSelfRef,
923923
importedUnionDecl->getDeclaredType(), /*implicit*/ true);
924924

925-
auto newValueDecl = setterDecl->getParameterList(1)->get(0);
925+
auto newValueDecl = setterDecl->getParameters()->get(0);
926926

927927
auto newValueRef = new (C) DeclRefExpr(newValueDecl, DeclNameLoc(),
928928
/*implicit*/ true);
@@ -1463,8 +1463,7 @@ static ConstructorDecl *createRawValueBridgingConstructor(
14631463
/*wantBody=*/false);
14641464
// Insert our custom init body
14651465
if (wantBody) {
1466-
auto selfDecl = init->getParameterList(0)->get(0);
1467-
1466+
auto selfDecl = init->getImplicitSelfDecl();
14681467
auto storedType = storedRawValue->getInterfaceType();
14691468

14701469
// Construct left-hand side.
@@ -1479,7 +1478,7 @@ static ConstructorDecl *createRawValueBridgingConstructor(
14791478

14801479
// Construct right-hand side.
14811480
// FIXME: get the parameter from the init, and plug it in here.
1482-
auto *paramDecl = init->getParameterList(1)->get(0);
1481+
auto *paramDecl = init->getParameters()->get(0);
14831482
auto *paramRef = new (ctx) DeclRefExpr(
14841483
paramDecl, DeclNameLoc(), /*Implicit=*/true);
14851484
paramRef->setType(paramDecl->getType());
@@ -1672,7 +1671,7 @@ buildSubscriptSetterDecl(ClangImporter::Implementation &Impl,
16721671
//
16731672
// Build a setter thunk with the latter signature that maps to the
16741673
// former.
1675-
auto valueIndex = setter->getParameterList(1);
1674+
auto valueIndex = setter->getParameters();
16761675

16771676
// 'self'
16781677
auto selfDecl = ParamDecl::createSelf(SourceLoc(), dc);
@@ -1728,7 +1727,7 @@ buildSubscriptSetterDecl(ClangImporter::Implementation &Impl,
17281727
/// Retrieve the element interface type and key param decl of a subscript
17291728
/// setter.
17301729
static std::pair<Type, ParamDecl *> decomposeSubscriptSetter(FuncDecl *setter) {
1731-
auto *PL = setter->getParameterList(1);
1730+
auto *PL = setter->getParameters();
17321731
if (PL->size() != 2)
17331732
return {nullptr, nullptr};
17341733

@@ -4810,8 +4809,8 @@ namespace {
48104809
// different (usually in something like nullability), but for Swift it's
48114810
// an AST invariant that's assumed and asserted elsewhere. If the type is
48124811
// different, just drop the setter, and leave the property as get-only.
4813-
assert(setter->getParameterLists().back()->size() == 1);
4814-
const ParamDecl *param = setter->getParameterLists().back()->get(0);
4812+
assert(setter->getParameters()->size() == 1);
4813+
const ParamDecl *param = setter->getParameters()->get(0);
48154814
if (!param->getInterfaceType()->isEqual(original->getInterfaceType()))
48164815
return;
48174816

@@ -6621,7 +6620,7 @@ SwiftDeclConverter::importSubscript(Decl *decl,
66216620
// Find the getter indices and make sure they match.
66226621
ParamDecl *getterIndex;
66236622
{
6624-
auto params = getter->getParameterList(1);
6623+
auto params = getter->getParameters();
66256624
if (params->size() != 1)
66266625
return nullptr;
66276626
getterIndex = params->get(0);
@@ -6630,11 +6629,7 @@ SwiftDeclConverter::importSubscript(Decl *decl,
66306629
// Compute the element type based on the getter, looking through
66316630
// the implicit 'self' parameter and the normal function
66326631
// parameters.
6633-
auto elementTy = getter->getInterfaceType()
6634-
->castTo<AnyFunctionType>()
6635-
->getResult()
6636-
->castTo<AnyFunctionType>()
6637-
->getResult();
6632+
auto elementTy = getter->getResultInterfaceType();
66386633
auto elementContextTy = getter->mapTypeIntoContext(elementTy);
66396634

66406635
// Local function to mark the setter unavailable.

0 commit comments

Comments
 (0)