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 {
5050 }
5151
5252 /// 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.
5555 @_spi ( Testing)
5656 public func lowerFunctionSignature(
5757 _ decl: VariableDeclSyntax ,
@@ -297,7 +297,7 @@ struct CdeclLowering {
297297 }
298298 }
299299
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.
301301 ///
302302 /// - Parameters:
303303 /// - type: The return type.
Original file line number Diff line number Diff line change @@ -227,26 +227,17 @@ extension VariableDeclSyntax {
227227 case . getter:
228228 return [ . get]
229229 case . accessors( let accessors) :
230- var hasGetter = false
231- var hasSetter = false
232-
233230 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 ]
239236 default : // Ignore willSet/didSet and unknown accessors.
240237 break
241238 }
242239 }
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]
250241 }
251242 }
252243
You can’t perform that action at this time.
0 commit comments