Skip to content

Commit

Permalink
ASTScope: AbstractFunctionBodyScope scopes are always current
Browse files Browse the repository at this point in the history
  • Loading branch information
slavapestov committed Sep 23, 2020
1 parent 8f586d0 commit d3d1cee
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
7 changes: 0 additions & 7 deletions include/swift/AST/ASTScope.h
Expand Up @@ -986,18 +986,11 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
public:
AbstractFunctionDecl *const decl;

/// \c Parser::parseAbstractFunctionBodyDelayed can call \c
/// AbstractFunctionDecl::setBody after the tree has been constructed. So if
/// this changes, have to rebuild body.
NullablePtr<BraceStmt> bodyWhenLastExpanded;

AbstractFunctionBodyScope(AbstractFunctionDecl *e) : decl(e) {}
virtual ~AbstractFunctionBodyScope() {}

protected:
ASTScopeImpl *expandSpecifically(ScopeCreator &scopeCreator) override;
void beCurrent() override;
bool isCurrentIfWasExpanded() const override;

private:
void expandAScopeThatDoesNotCreateANewInsertionPoint(ScopeCreator &);
Expand Down
8 changes: 0 additions & 8 deletions lib/AST/ASTScopeCreation.cpp
Expand Up @@ -1695,14 +1695,6 @@ bool ASTSourceFileScope::isCurrentIfWasExpanded() const {
return SF->getTopLevelDecls().size() == numberOfDeclsAlreadySeen;
}

void AbstractFunctionBodyScope::beCurrent() {
bodyWhenLastExpanded = decl->getBody(false);
}
bool AbstractFunctionBodyScope::isCurrentIfWasExpanded() const {
// Pass in false to keep the compiler from synthesizing one.
return bodyWhenLastExpanded == decl->getBody(false);
}

// Try to avoid the work of counting
static const bool assumeVarsDoNotGetAdded = true;

Expand Down

0 comments on commit d3d1cee

Please sign in to comment.