Skip to content

Commit 7bbc2ae

Browse files
committed
ASTPrinter: Print 'static' after attributes for PatternBindingDecls
1 parent dd80cd0 commit 7bbc2ae

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2318,15 +2318,19 @@ void PrintAST::visitPatternBindingDecl(PatternBindingDecl *decl) {
23182318

23192319
if (anyVar)
23202320
printDocumentationComment(anyVar);
2321-
if (decl->isStatic())
2322-
printStaticKeyword(decl->getCorrectStaticSpelling());
23232321

23242322
// FIXME: PatternBindingDecls don't have attributes themselves, so just assume
23252323
// the variables all have the same attributes. This isn't exactly true
23262324
// after type-checking, but it's close enough for now.
23272325
if (anyVar) {
23282326
printAttributes(anyVar);
23292327
printAccessibility(anyVar);
2328+
}
2329+
2330+
if (decl->isStatic())
2331+
printStaticKeyword(decl->getCorrectStaticSpelling());
2332+
2333+
if (anyVar) {
23302334
Printer << (anyVar->isSettable(anyVar->getDeclContext()) ? "var " : "let ");
23312335
} else {
23322336
Printer << "let ";

test/attr/attr_dynamic_infer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ extension FinalTests {
7878
set { }
7979
}
8080

81-
// CHECK: static @objc var x
81+
// CHECK: @objc static var x
8282
static var x: Int = 0
8383

8484
// CHECK: @objc static func bar

0 commit comments

Comments
 (0)