mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Statement checker] Remove redundant state.
Remove the `TheFunc` state, which is used only in a few places and can be trivially recomputed.
This commit is contained in:
@@ -53,6 +53,20 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/// Construct an AnyFunctionRef from a decl context that might be
|
||||
/// some sort of function.
|
||||
static Optional<AnyFunctionRef> fromDeclContext(DeclContext *dc) {
|
||||
if (auto fn = dyn_cast<AbstractFunctionDecl>(dc)) {
|
||||
return AnyFunctionRef(fn);
|
||||
}
|
||||
|
||||
if (auto ace = dyn_cast<AbstractClosureExpr>(dc)) {
|
||||
return AnyFunctionRef(ace);
|
||||
}
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
CaptureInfo getCaptureInfo() const {
|
||||
if (auto *AFD = TheFunction.dyn_cast<AbstractFunctionDecl *>())
|
||||
return AFD->getCaptureInfo();
|
||||
|
||||
Reference in New Issue
Block a user