Skip to content

Commit ee6c6f4

Browse files
committed
[CodeCompletion] Stop marking non-target function bodies 'Skipped'
1 parent 1ab4a47 commit ee6c6f4

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

include/swift/AST/Decl.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5935,8 +5935,7 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
59355935

59365936
/// Note that parsing for the body was delayed.
59375937
void setBodyDelayed(SourceRange bodyRange) {
5938-
assert(getBodyKind() == BodyKind::None ||
5939-
getBodyKind() == BodyKind::Skipped);
5938+
assert(getBodyKind() == BodyKind::None);
59405939
assert(bodyRange.isValid());
59415940
BodyRange = bodyRange;
59425941
setBodyKind(BodyKind::Unparsed);

lib/AST/Decl.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6728,8 +6728,7 @@ void AbstractFunctionDecl::setBody(BraceStmt *S, BodyKind NewBodyKind) {
67286728

67296729
void AbstractFunctionDecl::setBodyToBeReparsed(SourceRange bodyRange) {
67306730
assert(bodyRange.isValid());
6731-
assert(getBodyKind() == BodyKind::None ||
6732-
getBodyKind() == BodyKind::Skipped ||
6731+
assert(getBodyKind() == BodyKind::Unparsed ||
67336732
getBodyKind() == BodyKind::Parsed ||
67346733
getBodyKind() == BodyKind::TypeChecked);
67356734
assert(getASTContext().SourceMgr.rangeContainsTokenLoc(

lib/Parse/ParseDecl.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6248,15 +6248,12 @@ void Parser::consumeAbstractFunctionBody(AbstractFunctionDecl *AFD,
62486248

62496249
AFD->setBodyDelayed(BodyRange);
62506250

6251-
if (isCodeCompletionFirstPass()) {
6252-
if (SourceMgr.rangeContainsCodeCompletionLoc(BodyRange)) {
6253-
State->setCodeCompletionDelayedDeclState(
6254-
SourceMgr, L->getBufferID(),
6255-
CodeCompletionDelayedDeclKind::FunctionBody,
6256-
PD_Default, AFD, BodyRange, BeginParserPosition.PreviousLoc);
6257-
} else {
6258-
AFD->setBodySkipped(BodyRange);
6259-
}
6251+
if (isCodeCompletionFirstPass() &&
6252+
SourceMgr.rangeContainsCodeCompletionLoc(BodyRange)) {
6253+
State->setCodeCompletionDelayedDeclState(
6254+
SourceMgr, L->getBufferID(),
6255+
CodeCompletionDelayedDeclKind::FunctionBody,
6256+
PD_Default, AFD, BodyRange, BeginParserPosition.PreviousLoc);
62606257
}
62616258
}
62626259

0 commit comments

Comments
 (0)