Skip to content

Commit 951988c

Browse files
committed
[IDE] Return Code Completion Status in Access Control Completion
1 parent 78b4e85 commit 951988c

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2912,10 +2912,13 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
29122912

29132913
consumeAttributeLParen();
29142914

2915-
if (Tok.is(tok::code_complete) && CodeCompletionCallbacks) {
2916-
CodeCompletionCallbacks->completeDeclAttrParam(
2917-
ParameterizedDeclAttributeKind::AccessControl, 0, false);
2915+
if (Tok.is(tok::code_complete)) {
2916+
if (CodeCompletionCallbacks) {
2917+
CodeCompletionCallbacks->completeDeclAttrParam(
2918+
ParameterizedDeclAttributeKind::AccessControl, 0, false);
2919+
}
29182920
consumeToken(tok::code_complete);
2921+
return makeParserCodeCompletionStatus();
29192922
}
29202923

29212924
// Parse the subject.
@@ -2926,18 +2929,24 @@ ParserStatus Parser::parseNewDeclAttribute(DeclAttributes &Attributes,
29262929

29272930
const Token &Tok2 = peekToken();
29282931

2929-
if (CodeCompletionCallbacks) {
2930-
if (Tok.is(tok::code_complete)) {
2932+
if (Tok.is(tok::code_complete)) {
2933+
if (CodeCompletionCallbacks) {
29312934
CodeCompletionCallbacks->completeDeclAttrParam(
29322935
ParameterizedDeclAttributeKind::AccessControl, 0, false);
2933-
consumeToken(tok::code_complete);
2934-
} else if (Tok2.is(tok::code_complete) && Tok.is(tok::identifier) &&
2935-
!Tok.isContextualDeclKeyword()) {
2936-
consumeToken(tok::identifier);
2936+
}
2937+
consumeToken(tok::code_complete);
2938+
return makeParserCodeCompletionStatus();
2939+
}
2940+
2941+
if (Tok2.is(tok::code_complete) && Tok.is(tok::identifier) &&
2942+
!Tok.isContextualDeclKeyword()) {
2943+
consumeToken(tok::identifier);
2944+
if (CodeCompletionCallbacks) {
29372945
CodeCompletionCallbacks->completeDeclAttrParam(
29382946
ParameterizedDeclAttributeKind::AccessControl, 0, false);
2939-
consumeToken(tok::code_complete);
29402947
}
2948+
consumeToken(tok::code_complete);
2949+
return makeParserCodeCompletionStatus();
29412950
}
29422951

29432952
// Minimal recovery: if there's a single token and then an r_paren,

0 commit comments

Comments
 (0)