Skip to content

Commit 76d394a

Browse files
committed
[Parser] Pass code completion status from attribute parsing to decl parsing
This is needed to be able to perform code completion inside `@freestanding` and `@attached`.
1 parent f7b6740 commit 76d394a

File tree

3 files changed

+113
-94
lines changed

3 files changed

+113
-94
lines changed

include/swift/Parse/Parser.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,9 +1024,10 @@ class Parser {
10241024
PatternBindingInitializer *initContext);
10251025

10261026
/// Parse the optional modifiers before a declaration.
1027-
bool parseDeclModifierList(DeclAttributes &Attributes, SourceLoc &StaticLoc,
1028-
StaticSpellingKind &StaticSpelling,
1029-
bool isFromClangAttribute = false);
1027+
ParserStatus parseDeclModifierList(DeclAttributes &Attributes,
1028+
SourceLoc &StaticLoc,
1029+
StaticSpellingKind &StaticSpelling,
1030+
bool isFromClangAttribute = false);
10301031

10311032
/// Parse an availability attribute of the form
10321033
/// @available(*, introduced: 1.0, deprecated: 3.1).
@@ -1138,9 +1139,9 @@ class Parser {
11381139
ParserResult<CustomAttr> parseCustomAttribute(
11391140
SourceLoc atLoc, PatternBindingInitializer *&initContext);
11401141

1141-
bool parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
1142-
DeclAttrKind DK,
1143-
bool isFromClangAttribute = false);
1142+
ParserStatus parseNewDeclAttribute(DeclAttributes &Attributes,
1143+
SourceLoc AtLoc, DeclAttrKind DK,
1144+
bool isFromClangAttribute = false);
11441145

11451146
/// Parse a version tuple of the form x[.y[.z]]. Returns true if there was
11461147
/// an error parsing.

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7647,9 +7647,11 @@ ClangImporter::Implementation::importSwiftAttrAttributes(Decl *MappedDecl) {
76477647
} else {
76487648
SourceLoc staticLoc;
76497649
StaticSpellingKind staticSpelling;
7650-
hadError = parser.parseDeclModifierList(
7651-
MappedDecl->getAttrs(), staticLoc, staticSpelling,
7652-
/*isFromClangAttribute=*/true);
7650+
hadError = parser
7651+
.parseDeclModifierList(MappedDecl->getAttrs(), staticLoc,
7652+
staticSpelling,
7653+
/*isFromClangAttribute=*/true)
7654+
.isError();
76537655
}
76547656

76557657
if (hadError) {

0 commit comments

Comments
 (0)