File tree Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Expand file tree Collapse file tree 2 files changed +9
-18
lines changed Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ extension Swift2JavaTranslator {
50
50
}
51
51
52
52
/// Lower the given variable decl to a C-compatible entrypoint,
53
- /// providing all of the mappings between the parameter and result types
54
- /// of the original function and its `@_cdecl` counterpart.
53
+ /// providing the mappings between the `self` and value type of the variable
54
+ /// and its `@_cdecl` counterpart.
55
55
@_spi ( Testing)
56
56
public func lowerFunctionSignature(
57
57
_ decl: VariableDeclSyntax ,
@@ -297,7 +297,7 @@ struct CdeclLowering {
297
297
}
298
298
}
299
299
300
- /// Lower a Swift result type to cdecl parameters and return type.
300
+ /// Lower a Swift result type to cdecl out parameters and return type.
301
301
///
302
302
/// - Parameters:
303
303
/// - type: The return type.
Original file line number Diff line number Diff line change @@ -227,26 +227,17 @@ extension VariableDeclSyntax {
227
227
case . getter:
228
228
return [ . get]
229
229
case . accessors( let accessors) :
230
- var hasGetter = false
231
- var hasSetter = false
232
-
233
230
for accessor in accessors {
234
- switch accessor. accessorSpecifier {
235
- case . keyword ( . get ) , . keyword ( . _read ) , . keyword ( . unsafeAddress ) :
236
- hasGetter = true
237
- case . keyword ( . set ) , . keyword( . _modify ) , . keyword( . unsafeMutableAddress ) :
238
- hasSetter = true
231
+ switch accessor. accessorSpecifier. tokenKind {
232
+ // Existence of any write accessor or observer implies this supports read/write.
233
+ case . keyword ( . set ) , . keyword ( . _modify ) , . keyword ( . unsafeMutableAddress ) ,
234
+ . keyword( . willSet ) , . keyword( . didSet ) :
235
+ return [ . get , . set ]
239
236
default : // Ignore willSet/didSet and unknown accessors.
240
237
break
241
238
}
242
239
}
243
-
244
- switch ( hasGetter, hasSetter) {
245
- case ( true , true ) : return [ . get, . set]
246
- case ( true , false ) : return [ . get]
247
- case ( false , true ) : return [ . set]
248
- case ( false , false ) : break
249
- }
240
+ return [ . get]
250
241
}
251
242
}
252
243
You can’t perform that action at this time.
0 commit comments