|
2 | 2 | //
|
3 | 3 | // This source file is part of the Swift.org open source project
|
4 | 4 | //
|
5 |
| -// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors |
| 5 | +// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors |
6 | 6 | // Licensed under Apache License v2.0 with Runtime Library Exception
|
7 | 7 | //
|
8 | 8 | // See https://swift.org/LICENSE.txt for license information
|
@@ -1837,20 +1837,15 @@ class ObjCPrinter : private DeclVisitor<ObjCPrinter>,
|
1837 | 1837 | /// "(A) -> ((B) -> C)" becomes "C (^ (^)(A))(B)".
|
1838 | 1838 | void finishFunctionType(const FunctionType *FT) {
|
1839 | 1839 | os << ")(";
|
1840 |
| - Type paramsTy = FT->getInput(); |
1841 |
| - if (auto tupleTy = paramsTy->getAs<TupleType>()) { |
1842 |
| - if (FT->getParams().empty()) { |
1843 |
| - os << "void"; |
1844 |
| - } else { |
1845 |
| - interleave(tupleTy->getElements(), |
1846 |
| - [this](TupleTypeElt elt) { |
1847 |
| - print(elt.getType(), OTK_None, elt.getName(), |
1848 |
| - IsFunctionParam); |
1849 |
| - }, |
1850 |
| - [this] { os << ", "; }); |
1851 |
| - } |
| 1840 | + if (!FT->getParams().empty()) { |
| 1841 | + interleave(FT->getParams(), |
| 1842 | + [this](const AnyFunctionType::Param ¶m) { |
| 1843 | + print(param.getType(), OTK_None, param.getLabel(), |
| 1844 | + IsFunctionParam); |
| 1845 | + }, |
| 1846 | + [this] { os << ", "; }); |
1852 | 1847 | } else {
|
1853 |
| - print(paramsTy, OTK_None, Identifier(), IsFunctionParam); |
| 1848 | + os << "void"; |
1854 | 1849 | }
|
1855 | 1850 | os << ")";
|
1856 | 1851 | }
|
@@ -1993,7 +1988,8 @@ class ReferencedTypeFinder : public TypeVisitor<ReferencedTypeFinder> {
|
1993 | 1988 | }
|
1994 | 1989 |
|
1995 | 1990 | void visitAnyFunctionType(AnyFunctionType *fnTy) {
|
1996 |
| - visit(fnTy->getInput()); |
| 1991 | + for (auto ¶m : fnTy->getParams()) |
| 1992 | + visit(param.getType()); |
1997 | 1993 | visit(fnTy->getResult());
|
1998 | 1994 | }
|
1999 | 1995 |
|
|
0 commit comments