Skip to content

Commit 1ece483

Browse files
committed
[AST] ASTPrinter: Print init accessor for SIL
1 parent cabc545 commit 1ece483

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ PrintOptions PrintOptions::printSwiftInterfaceFile(ModuleDecl *ModuleToPrint,
309309
}
310310
}
311311

312+
if (auto *accessor = dyn_cast<AccessorDecl>(D)) {
313+
if (accessor->isInitAccessor() && !options.PrintForSIL)
314+
return false;
315+
}
316+
312317
return ShouldPrintChecker::shouldPrint(D, options);
313318
}
314319
};
@@ -2259,8 +2264,12 @@ void PrintAST::printAccessors(const AbstractStorageDecl *ASD) {
22592264
accessorsToPrint.push_back(Accessor);
22602265
};
22612266

2267+
if (ASD->hasInitAccessor())
2268+
AddAccessorToPrint(AccessorKind::Init);
2269+
22622270
if (PrintAbstract) {
22632271
AddAccessorToPrint(AccessorKind::Get);
2272+
22642273
if (ASD->supportsMutation())
22652274
AddAccessorToPrint(AccessorKind::Set);
22662275
} else {

0 commit comments

Comments
 (0)