mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[InterfaceGen] Print abstract accessors in protocols (#19379)
* [InterfaceGen] Print abstract accessors in protocols This patch slightly cleans up printing accessors and ensures we print accessors abstractly in protocol context for textual interfaces. It also removes some assuptions around the FunctionBody callback and makes them more explicit. * Print getter and setter for didSet decls * Test _read and _modify * Fix logic for skipping willSet/didSet * Update 'final' test for new getter printing behavior
This commit is contained in:
@@ -135,13 +135,32 @@ struct PrintOptions {
|
||||
/// \brief Whether to print *any* accessors on properties.
|
||||
bool PrintPropertyAccessors = true;
|
||||
|
||||
/// \brief Whether to print the accessors of a property abstractly,
|
||||
/// i.e. always as get and set rather than the specific accessors
|
||||
/// actually used to implement the property.
|
||||
/// Whether to print the accessors of a property abstractly,
|
||||
/// i.e. always as:
|
||||
/// ```
|
||||
/// var x: Int { get set }
|
||||
/// ```
|
||||
/// rather than the specific accessors actually used to implement the
|
||||
/// property.
|
||||
///
|
||||
/// Printing function definitions takes priority over this setting.
|
||||
bool AbstractAccessors = true;
|
||||
|
||||
/// Whether to print a property with only a single getter using the shorthand
|
||||
/// ```
|
||||
/// var x: Int { return y }
|
||||
/// ```
|
||||
/// vs.
|
||||
/// ```
|
||||
/// var x: Int {
|
||||
/// get { return y }
|
||||
/// }
|
||||
/// ```
|
||||
bool CollapseSingleGetterProperty = true;
|
||||
|
||||
/// Whether to print the bodies of accessors in protocol context.
|
||||
bool PrintAccessorBodiesInProtocols = false;
|
||||
|
||||
/// \brief Whether to print type definitions.
|
||||
bool TypeDefinitions = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user