@@ -1213,10 +1213,13 @@ NameImporter::considerAsyncImport(
1213
1213
// handler.
1214
1214
Optional<StringRef> newBaseName;
1215
1215
if (isCompletionHandlerParamName (paramNames[completionHandlerParamNameIndex])) {
1216
- // The parameter itself has an appropriate name.
1216
+ // The argument label itself has an appropriate name.
1217
1217
} else if (!hasCustomName && completionHandlerParamIndex == 0 &&
1218
1218
(newBaseName = isCompletionHandlerInBaseName (baseName))) {
1219
1219
// The base name implies that the first parameter is a completion handler.
1220
+ } else if (isCompletionHandlerParamName (
1221
+ params[completionHandlerParamIndex]->getName ())) {
1222
+ // The parameter has an appropriate name.
1220
1223
} else {
1221
1224
return None;
1222
1225
}
@@ -1238,6 +1241,10 @@ NameImporter::considerAsyncImport(
1238
1241
if (isInitializer)
1239
1242
return notAsync (" initializers cannot be async" );
1240
1243
1244
+ // Accessors are never imported as async.
1245
+ if (clangDecl->isPropertyAccessor ())
1246
+ return notAsync (" method is a property accessor" );
1247
+
1241
1248
// Check whether we method has a suitable return type.
1242
1249
if (clangDecl->getReturnType ()->isVoidType ()) {
1243
1250
// 'void' is the common case; the method produces no synchronous result.
@@ -1515,7 +1522,8 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
1515
1522
else if (parsedName.IsSetter )
1516
1523
result.info .accessorKind = ImportedAccessorKind::PropertySetter;
1517
1524
1518
- if (method && parsedName.IsFunctionName ) {
1525
+ if (method && parsedName.IsFunctionName &&
1526
+ result.info .accessorKind == ImportedAccessorKind::None) {
1519
1527
// Get the parameters.
1520
1528
ArrayRef<const clang::ParmVarDecl *> params{method->param_begin (),
1521
1529
method->param_end ()};
@@ -1787,16 +1795,6 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
1787
1795
result.info .errorInfo = *errorInfo;
1788
1796
}
1789
1797
1790
- if (version.supportsConcurrency ()) {
1791
- if (auto asyncInfo = considerAsyncImport (
1792
- objcMethod, baseName, argumentNames, params, isInitializer,
1793
- /* hasCustomName=*/ false ,
1794
- result.getErrorInfo ())) {
1795
- result.info .hasAsyncInfo = true ;
1796
- result.info .asyncInfo = *asyncInfo;
1797
- }
1798
- }
1799
-
1800
1798
isFunction = true ;
1801
1799
1802
1800
// Is this one of the accessors for subscripts?
@@ -1814,6 +1812,17 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
1814
1812
result.info .accessorKind = ImportedAccessorKind::SubscriptSetter;
1815
1813
}
1816
1814
1815
+ if (version.supportsConcurrency () &&
1816
+ result.info .accessorKind == ImportedAccessorKind::None) {
1817
+ if (auto asyncInfo = considerAsyncImport (
1818
+ objcMethod, baseName, argumentNames, params, isInitializer,
1819
+ /* hasCustomName=*/ false ,
1820
+ result.getErrorInfo ())) {
1821
+ result.info .hasAsyncInfo = true ;
1822
+ result.info .asyncInfo = *asyncInfo;
1823
+ }
1824
+ }
1825
+
1817
1826
break ;
1818
1827
}
1819
1828
}
0 commit comments