|
21 | 21 | #include "swift/AST/ForeignAsyncConvention.h" |
22 | 22 | #include "swift/AST/ForeignErrorConvention.h" |
23 | 23 | #include "swift/AST/GenericEnvironment.h" |
24 | | -#include "swift/AST/GenericParamList.h" |
25 | 24 | #include "swift/AST/Initializer.h" |
26 | 25 | #include "swift/AST/ParameterList.h" |
27 | 26 | #include "swift/AST/ProtocolConformance.h" |
@@ -114,107 +113,6 @@ namespace { |
114 | 113 | }; |
115 | 114 | } // end anonymous namespace |
116 | 115 |
|
117 | | -//===----------------------------------------------------------------------===// |
118 | | -// Generic param list printing. |
119 | | -//===----------------------------------------------------------------------===// |
120 | | - |
121 | | -void RequirementRepr::dump() const { |
122 | | - print(llvm::errs()); |
123 | | - llvm::errs() << "\n"; |
124 | | -} |
125 | | - |
126 | | -void RequirementRepr::printImpl(ASTPrinter &out) const { |
127 | | - auto printLayoutConstraint = |
128 | | - [&](const LayoutConstraintLoc &LayoutConstraintLoc) { |
129 | | - LayoutConstraintLoc.getLayoutConstraint()->print(out, PrintOptions()); |
130 | | - }; |
131 | | - |
132 | | - switch (getKind()) { |
133 | | - case RequirementReprKind::LayoutConstraint: |
134 | | - if (auto *repr = getSubjectRepr()) { |
135 | | - repr->print(out, PrintOptions()); |
136 | | - } |
137 | | - out << " : "; |
138 | | - printLayoutConstraint(getLayoutConstraintLoc()); |
139 | | - break; |
140 | | - |
141 | | - case RequirementReprKind::TypeConstraint: |
142 | | - if (auto *repr = getSubjectRepr()) { |
143 | | - repr->print(out, PrintOptions()); |
144 | | - } |
145 | | - out << " : "; |
146 | | - if (auto *repr = getConstraintRepr()) { |
147 | | - repr->print(out, PrintOptions()); |
148 | | - } |
149 | | - break; |
150 | | - |
151 | | - case RequirementReprKind::SameType: |
152 | | - if (auto *repr = getFirstTypeRepr()) { |
153 | | - repr->print(out, PrintOptions()); |
154 | | - } |
155 | | - out << " == "; |
156 | | - if (auto *repr = getSecondTypeRepr()) { |
157 | | - repr->print(out, PrintOptions()); |
158 | | - } |
159 | | - break; |
160 | | - } |
161 | | -} |
162 | | - |
163 | | -void RequirementRepr::print(raw_ostream &out) const { |
164 | | - StreamPrinter printer(out); |
165 | | - printImpl(printer); |
166 | | -} |
167 | | -void RequirementRepr::print(ASTPrinter &out) const { |
168 | | - printImpl(out); |
169 | | -} |
170 | | - |
171 | | -static void printTrailingRequirements(ASTPrinter &Printer, |
172 | | - ArrayRef<RequirementRepr> Reqs, |
173 | | - bool printWhereKeyword) { |
174 | | - if (Reqs.empty()) return; |
175 | | - |
176 | | - if (printWhereKeyword) |
177 | | - Printer << " where "; |
178 | | - interleave( |
179 | | - Reqs, |
180 | | - [&](const RequirementRepr &req) { |
181 | | - Printer.callPrintStructurePre(PrintStructureKind::GenericRequirement); |
182 | | - req.print(Printer); |
183 | | - Printer.printStructurePost(PrintStructureKind::GenericRequirement); |
184 | | - }, |
185 | | - [&] { Printer << ", "; }); |
186 | | -} |
187 | | - |
188 | | -void GenericParamList::print(llvm::raw_ostream &OS) const { |
189 | | - OS << '<'; |
190 | | - interleave(*this, |
191 | | - [&](const GenericTypeParamDecl *P) { |
192 | | - OS << P->getName(); |
193 | | - if (!P->getInherited().empty()) { |
194 | | - OS << " : "; |
195 | | - P->getInherited()[0].getType().print(OS); |
196 | | - } |
197 | | - }, |
198 | | - [&] { OS << ", "; }); |
199 | | - |
200 | | - StreamPrinter Printer(OS); |
201 | | - printTrailingRequirements(Printer, getRequirements(), |
202 | | - /*printWhereKeyword*/true); |
203 | | - OS << '>'; |
204 | | -} |
205 | | - |
206 | | -void GenericParamList::dump() const { |
207 | | - print(llvm::errs()); |
208 | | - llvm::errs() << '\n'; |
209 | | -} |
210 | | - |
211 | | -void TrailingWhereClause::print(llvm::raw_ostream &OS, |
212 | | - bool printWhereKeyword) const { |
213 | | - StreamPrinter Printer(OS); |
214 | | - printTrailingRequirements(Printer, getRequirements(), |
215 | | - printWhereKeyword); |
216 | | -} |
217 | | - |
218 | 116 | static void printGenericParameters(raw_ostream &OS, GenericParamList *Params) { |
219 | 117 | if (!Params) |
220 | 118 | return; |
@@ -3139,6 +3037,12 @@ class PrintTypeRepr : public TypeReprVisitor<PrintTypeRepr> { |
3139 | 3037 | PrintWithColorRAII(OS, ParenthesisColor) << ')'; |
3140 | 3038 | } |
3141 | 3039 |
|
| 3040 | + void visitNamedOpaqueReturnTypeRepr(NamedOpaqueReturnTypeRepr *T) { |
| 3041 | + printCommon("type_named_opaque_return") << '\n'; |
| 3042 | + printRec(T->getBase()); |
| 3043 | + PrintWithColorRAII(OS, ParenthesisColor) << ')'; |
| 3044 | + } |
| 3045 | + |
3142 | 3046 | void visitPlaceholderTypeRepr(PlaceholderTypeRepr *T) { |
3143 | 3047 | printCommon("type_placeholder"); |
3144 | 3048 | PrintWithColorRAII(OS, ParenthesisColor) << ')'; |
|
0 commit comments