|
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,111 +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 | | -void GenericParamList::dump() const { |
172 | | - print(llvm::errs()); |
173 | | - llvm::errs() << '\n'; |
174 | | -} |
175 | | - |
176 | | -void GenericParamList::print(raw_ostream &out, const PrintOptions &PO) const { |
177 | | - StreamPrinter printer(out); |
178 | | - print(printer, PO); |
179 | | -} |
180 | | - |
181 | | -static void printTrailingRequirements(ASTPrinter &Printer, |
182 | | - ArrayRef<RequirementRepr> Reqs, |
183 | | - bool printWhereKeyword) { |
184 | | - if (Reqs.empty()) return; |
185 | | - |
186 | | - if (printWhereKeyword) |
187 | | - Printer << " where "; |
188 | | - interleave( |
189 | | - Reqs, |
190 | | - [&](const RequirementRepr &req) { |
191 | | - Printer.callPrintStructurePre(PrintStructureKind::GenericRequirement); |
192 | | - req.print(Printer); |
193 | | - Printer.printStructurePost(PrintStructureKind::GenericRequirement); |
194 | | - }, |
195 | | - [&] { Printer << ", "; }); |
196 | | -} |
197 | | - |
198 | | -void GenericParamList::print(ASTPrinter &Printer, const PrintOptions &PO) const { |
199 | | - Printer << '<'; |
200 | | - interleave(*this, |
201 | | - [&](const GenericTypeParamDecl *P) { |
202 | | - Printer << P->getName(); |
203 | | - if (!P->getInherited().empty()) { |
204 | | - Printer << " : "; |
205 | | - P->getInherited()[0].getType().print(Printer, PO); |
206 | | - } |
207 | | - }, |
208 | | - [&] { Printer << ", "; }); |
209 | | - |
210 | | - printTrailingRequirements(Printer, getRequirements(), |
211 | | - /*printWhereKeyword*/true); |
212 | | - Printer << '>'; |
213 | | -} |
214 | | - |
215 | | -void TrailingWhereClause::print(llvm::raw_ostream &OS, |
216 | | - bool printWhereKeyword) const { |
217 | | - StreamPrinter Printer(OS); |
218 | | - printTrailingRequirements(Printer, getRequirements(), |
219 | | - printWhereKeyword); |
220 | | -} |
221 | | - |
222 | 116 | static void printGenericParameters(raw_ostream &OS, GenericParamList *Params) { |
223 | 117 | if (!Params) |
224 | 118 | return; |
@@ -3143,9 +3037,8 @@ class PrintTypeRepr : public TypeReprVisitor<PrintTypeRepr> { |
3143 | 3037 | PrintWithColorRAII(OS, ParenthesisColor) << ')'; |
3144 | 3038 | } |
3145 | 3039 |
|
3146 | | - void |
3147 | | - visitNamedOpaqueReturnTypeRepr(NamedOpaqueReturnTypeRepr *T) { |
3148 | | - printCommon("type_opaque_return_parameterized") << '\n'; |
| 3040 | + void visitNamedOpaqueReturnTypeRepr(NamedOpaqueReturnTypeRepr *T) { |
| 3041 | + printCommon("type_named_opaque_return") << '\n'; |
3149 | 3042 | printRec(T->getBase()); |
3150 | 3043 | PrintWithColorRAII(OS, ParenthesisColor) << ')'; |
3151 | 3044 | } |
|
0 commit comments