Skip to content

Commit aafa418

Browse files
review: break the attribute name into its own fragment again
1 parent 8eb2c50 commit aafa418

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

lib/SymbolGraphGen/DeclarationFragmentPrinter.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,13 @@ void DeclarationFragmentPrinter::printStructurePre(PrintStructureKind Kind,
136136
void DeclarationFragmentPrinter::printTypeRef(Type T, const TypeDecl *RefTo,
137137
Identifier Name,
138138
PrintNameContext NameContext) {
139-
if (Kind != FragmentKind::Attribute)
139+
if (Kind != FragmentKind::Attribute) {
140140
openFragment(FragmentKind::TypeIdentifier);
141+
} else {
142+
// create a separate fragment so that only the attribute name is linkable
143+
closeFragment();
144+
openFragment(FragmentKind::Attribute);
145+
}
141146
printText(Name.str());
142147
USR.clear();
143148

test/SymbolGraph/Symbols/Mixins/DeclarationFragments/Full/CustomAttr.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ public func wrapped(@SomeWrapper arg: Int) {}
3232
// CHECK-NEXT: },
3333
// CHECK-NEXT: {
3434
// CHECK-NEXT: "kind": "attribute",
35-
// CHECK-NEXT: "spelling": "@SomeWrapper",
35+
// CHECK-NEXT: "spelling": "@"
36+
// CHECK-NEXT: },
37+
// CHECK-NEXT: {
38+
// CHECK-NEXT: "kind": "attribute",
39+
// CHECK-NEXT: "spelling": "SomeWrapper",
3640
// CHECK-NEXT: "preciseIdentifier": "s:10CustomAttr11SomeWrapperV"
3741
// CHECK-NEXT: },
3842
// CHECK-NEXT: {

0 commit comments

Comments
 (0)