@@ -205,55 +205,63 @@ class AbstractFunction {
205
205
Expr *TheExpr;
206
206
};
207
207
unsigned TheKind : 2 ;
208
- unsigned IsRethrows : 1 ;
209
208
unsigned ParamCount : 2 ;
210
- FunctionRethrowingKind rethrowingKind ;
209
+ FunctionRethrowingKind RethrowingKind ;
211
210
ConcreteDeclRef declRef;
212
211
213
212
public:
214
213
explicit AbstractFunction (Kind kind, Expr *fn, ConcreteDeclRef declRef)
215
214
: TheKind(kind),
216
- IsRethrows(false ),
217
215
ParamCount(1 ),
218
- rethrowingKind (FunctionRethrowingKind::Invalid ),
216
+ RethrowingKind (FunctionRethrowingKind::None ),
219
217
declRef(declRef) {
220
218
TheExpr = fn;
221
219
}
222
220
223
221
explicit AbstractFunction (AbstractFunctionDecl *fn, ConcreteDeclRef declRef)
224
222
: TheKind(Kind::Function),
225
- IsRethrows(fn->getAttrs ().hasAttribute<RethrowsAttr>()),
226
223
ParamCount(fn->getNumCurryLevels ()),
227
- rethrowingKind (fn->getRethrowingKind ()),
224
+ RethrowingKind (fn->getRethrowingKind ()),
228
225
declRef(declRef) {
229
226
TheFunction = fn;
230
227
}
231
228
232
229
explicit AbstractFunction (AbstractClosureExpr *closure,
233
230
ConcreteDeclRef declRef)
234
231
: TheKind(Kind::Closure),
235
- IsRethrows(false ),
236
232
ParamCount(1 ),
237
- rethrowingKind (FunctionRethrowingKind::Invalid ),
233
+ RethrowingKind (FunctionRethrowingKind::None ),
238
234
declRef(declRef) {
239
235
TheClosure = closure;
240
236
}
241
237
242
238
explicit AbstractFunction (ParamDecl *parameter, ConcreteDeclRef declRef)
243
239
: TheKind(Kind::Parameter),
244
- IsRethrows(false ),
245
240
ParamCount(1 ),
246
- rethrowingKind (FunctionRethrowingKind::Invalid ),
241
+ RethrowingKind (FunctionRethrowingKind::None ),
247
242
declRef(declRef) {
248
243
TheParameter = parameter;
249
244
}
250
245
251
246
Kind getKind () const { return Kind (TheKind); }
252
247
253
248
// / Whether the function is marked 'rethrows'.
254
- bool isBodyRethrows () const { return IsRethrows; }
249
+ bool isBodyRethrows () const {
250
+ switch (RethrowingKind) {
251
+ case FunctionRethrowingKind::None:
252
+ case FunctionRethrowingKind::Throws:
253
+ return false ;
254
+
255
+ case FunctionRethrowingKind::ByClosure:
256
+ case FunctionRethrowingKind::ByConformance:
257
+ case FunctionRethrowingKind::Invalid:
258
+ return true ;
259
+ }
260
+ }
255
261
256
- FunctionRethrowingKind getRethrowingKind () const { return rethrowingKind; }
262
+ FunctionRethrowingKind getRethrowingKind () const {
263
+ return RethrowingKind;
264
+ }
257
265
258
266
unsigned getNumArgumentsForFullApply () const {
259
267
return ParamCount;
0 commit comments