Skip to content

Commit 694c998

Browse files
committed
Remove AbstractClosureExpr::hasBody() not needed anymore as suggested in review
1 parent e3d68c7 commit 694c998

File tree

3 files changed

+0
-17
lines changed

3 files changed

+0
-17
lines changed

include/swift/AST/Expr.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3863,9 +3863,6 @@ class AbstractClosureExpr : public DeclContext, public Expr {
38633863
/// Only valid when \c hasSingleExpressionBody() is true.
38643864
Expr *getSingleExpressionBody() const;
38653865

3866-
/// Whether this closure has a body
3867-
bool hasBody() const;
3868-
38693866
/// Returns the body of closures that have a body
38703867
/// returns nullptr if the closure doesn't have a body
38713868
BraceStmt *getBody() const;

lib/AST/Expr.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,19 +1885,7 @@ void AbstractClosureExpr::setParameterList(ParameterList *P) {
18851885
P->setDeclContextOfParamDecls(this);
18861886
}
18871887

1888-
bool AbstractClosureExpr::hasBody() const {
1889-
switch (getKind()) {
1890-
case ExprKind::Closure:
1891-
case ExprKind::AutoClosure:
1892-
return true;
1893-
default:
1894-
return false;
1895-
}
1896-
}
1897-
18981888
BraceStmt * AbstractClosureExpr::getBody() const {
1899-
if (!hasBody())
1900-
return nullptr;
19011889
if (const AutoClosureExpr *autocls = dyn_cast<AutoClosureExpr>(this))
19021890
return autocls->getBody();
19031891
if (const ClosureExpr *cls = dyn_cast<ClosureExpr>(this))

lib/SIL/IR/SILProfiler.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ shouldWalkIntoExpr(Expr *E, ASTWalker::ParentTy Parent, SILDeclRef Constant) {
213213
// initializer instead.
214214
if (!Parent.isNull() || !Constant || !Constant.getAbstractClosureExpr())
215215
return Action::SkipChildren(E);
216-
217-
assert(CE->hasBody());
218216
}
219217
return Action::Continue(E);
220218
}

0 commit comments

Comments
 (0)