mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #27786 from davidungar/fix-lazy-function-bodies-rdar-56384593
[NameLookup, ASTScope] Create lazily-parsed function body scopes.
This commit is contained in:
@@ -1359,8 +1359,8 @@ void AbstractFunctionDeclScope::expandAScopeThatDoesNotCreateANewInsertionPoint(
|
||||
}
|
||||
// Create scope for the body.
|
||||
// We create body scopes when there is no body for source kit to complete
|
||||
// erroneous code in bodies. But don't let compiler synthesize one.
|
||||
if (decl->getBodySourceRange().isValid() && decl->getBody(false)) {
|
||||
// erroneous code in bodies.
|
||||
if (decl->getBodySourceRange().isValid()) {
|
||||
if (AbstractFunctionBodyScope::isAMethod(decl))
|
||||
scopeCreator.constructExpandAndInsertUncheckable<MethodBodyScope>(leaf,
|
||||
decl);
|
||||
@@ -1901,6 +1901,7 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user