Skip to content

Commit 8316c2a

Browse files
committed
---
yaml --- r: 340797 b: refs/heads/rxwei-patch-1 c: 197ddb5 h: refs/heads/master i: 340795: 04f92bf
1 parent ce8a28c commit 8316c2a

File tree

4 files changed

+6
-17
lines changed

4 files changed

+6
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: dcec244c0bb2b18545ea6a79ab40663647879da4
1018+
refs/heads/rxwei-patch-1: 197ddb57ab992a0dd8f515ec178244ff81be553b
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/include/swift/AST/Decl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7205,7 +7205,7 @@ inline EnumElementDecl *EnumDecl::getUniqueElement(bool hasValue) const {
72057205
}
72067206

72077207
/// Retrieve parameter declaration from the given source at given index.
7208-
const ParamDecl *getParameterAt(ValueDecl *source, unsigned index);
7208+
const ParamDecl *getParameterAt(const ValueDecl *source, unsigned index);
72097209

72107210
/// Display Decl subclasses.
72117211
void simple_display(llvm::raw_ostream &out, const Decl *decl);

branches/rxwei-patch-1/lib/AST/Decl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5990,7 +5990,7 @@ DeclName AbstractFunctionDecl::getEffectiveFullName() const {
59905990
return DeclName();
59915991
}
59925992

5993-
const ParamDecl *swift::getParameterAt(ValueDecl *source, unsigned index) {
5993+
const ParamDecl *swift::getParameterAt(const ValueDecl *source, unsigned index) {
59945994
const ParameterList *paramList;
59955995
if (auto *AFD = dyn_cast<AbstractFunctionDecl>(source)) {
59965996
paramList = AFD->getParameters();

branches/rxwei-patch-1/lib/Sema/CSRanking.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -370,20 +370,9 @@ static Type getAdjustedParamType(const AnyFunctionType::Param &param) {
370370

371371
// Is a particular parameter of a function or subscript declaration
372372
// declared to be an IUO?
373-
static bool paramIsIUO(Decl *decl, int paramNum) {
374-
if (auto *fn = dyn_cast<AbstractFunctionDecl>(decl)) {
375-
auto *paramList = fn->getParameters();
376-
auto *param = paramList->get(paramNum);
377-
return param->getAttrs().hasAttribute<ImplicitlyUnwrappedOptionalAttr>();
378-
}
379-
if (auto *ee = dyn_cast<EnumElementDecl>(decl)) {
380-
auto *param = ee->getParameterList()->get(paramNum);
381-
return param->getAttrs().hasAttribute<ImplicitlyUnwrappedOptionalAttr>();
382-
}
383-
384-
auto *subscript = cast<SubscriptDecl>(decl);
385-
auto *index = subscript->getIndices()->get(paramNum);
386-
return index->getAttrs().hasAttribute<ImplicitlyUnwrappedOptionalAttr>();
373+
static bool paramIsIUO(const ValueDecl *decl, int paramNum) {
374+
return swift::getParameterAt(decl, paramNum)->getAttrs()
375+
.hasAttribute<ImplicitlyUnwrappedOptionalAttr>();
387376
}
388377

389378
/// Determine whether the first declaration is as "specialized" as

0 commit comments

Comments
 (0)