Skip to content

Commit 4d160ec

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 db14ae8 commit 4d160ec

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
@@ -1019,9 +1019,10 @@ class Parser {
10191019
PatternBindingInitializer *initContext);
10201020

10211021
/// Parse the optional modifiers before a declaration.
1022-
bool parseDeclModifierList(DeclAttributes &Attributes, SourceLoc &StaticLoc,
1023-
StaticSpellingKind &StaticSpelling,
1024-
bool isFromClangAttribute = false);
1022+
ParserStatus parseDeclModifierList(DeclAttributes &Attributes,
1023+
SourceLoc &StaticLoc,
1024+
StaticSpellingKind &StaticSpelling,
1025+
bool isFromClangAttribute = false);
10251026

10261027
/// Parse an availability attribute of the form
10271028
/// @available(*, introduced: 1.0, deprecated: 3.1).
@@ -1133,9 +1134,9 @@ class Parser {
11331134
ParserResult<CustomAttr> parseCustomAttribute(
11341135
SourceLoc atLoc, PatternBindingInitializer *&initContext);
11351136

1136-
bool parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
1137-
DeclAttrKind DK,
1138-
bool isFromClangAttribute = false);
1137+
ParserStatus parseNewDeclAttribute(DeclAttributes &Attributes,
1138+
SourceLoc AtLoc, DeclAttrKind DK,
1139+
bool isFromClangAttribute = false);
11391140

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

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7658,9 +7658,11 @@ ClangImporter::Implementation::importSwiftAttrAttributes(Decl *MappedDecl) {
76587658
} else {
76597659
SourceLoc staticLoc;
76607660
StaticSpellingKind staticSpelling;
7661-
hadError = parser.parseDeclModifierList(
7662-
MappedDecl->getAttrs(), staticLoc, staticSpelling,
7663-
/*isFromClangAttribute=*/true);
7661+
hadError = parser
7662+
.parseDeclModifierList(MappedDecl->getAttrs(), staticLoc,
7663+
staticSpelling,
7664+
/*isFromClangAttribute=*/true)
7665+
.isError();
76647666
}
76657667

76667668
if (hadError) {

0 commit comments

Comments
 (0)