mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[InterfaceGen] Print property initializers in resilient, fixed-layout types (#19619)
Augment the ASTPrinter to print the name and text of initializer expressions if a property has an initializer and the type is @_fixed_layout and resides in a resilient module, and serialize the text for partial modules. With this change, all .swiftinterface files in the project (except for SwiftLang) compile to swiftmodules on macOS. rdar://43774580 rdar://43812188
This commit is contained in:
@@ -2438,9 +2438,19 @@ void Serializer::writePatternBindingInitializer(PatternBindingDecl *binding,
|
||||
unsigned bindingIndex) {
|
||||
using namespace decls_block;
|
||||
auto abbrCode = DeclTypeAbbrCodes[PatternBindingInitializerLayout::Code];
|
||||
|
||||
StringRef initStr;
|
||||
SmallString<128> scratch;
|
||||
auto &entry = binding->getPatternList()[bindingIndex];
|
||||
auto varDecl = entry.getAnchoringVarDecl();
|
||||
if (entry.hasInitStringRepresentation() &&
|
||||
varDecl->isInitExposedToClients()) {
|
||||
initStr = entry.getInitStringRepresentation(scratch);
|
||||
}
|
||||
|
||||
PatternBindingInitializerLayout::emitRecord(Out, ScratchRecord,
|
||||
abbrCode, addDeclRef(binding),
|
||||
bindingIndex);
|
||||
bindingIndex, initStr);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user