@@ -29,7 +29,7 @@ extension Swift2JavaTranslator {
2929 enclosingType: try enclosingType. map { try SwiftType ( $0, symbolTable: symbolTable) } ,
3030 symbolTable: symbolTable
3131 )
32- return try CdeclLowering ( swiftStdlibTypes: swiftStdlibTypes) . lowerFunctionSignature ( signature, apiKind : . function )
32+ return try CdeclLowering ( swiftStdlibTypes: swiftStdlibTypes) . lowerFunctionSignature ( signature)
3333 }
3434
3535 /// Lower the given initializer to a C-compatible entrypoint,
@@ -46,7 +46,7 @@ extension Swift2JavaTranslator {
4646 symbolTable: symbolTable
4747 )
4848
49- return try CdeclLowering ( swiftStdlibTypes: swiftStdlibTypes) . lowerFunctionSignature ( signature, apiKind : . initializer )
49+ return try CdeclLowering ( swiftStdlibTypes: swiftStdlibTypes) . lowerFunctionSignature ( signature)
5050 }
5151
5252 /// Lower the given variable decl to a C-compatible entrypoint,
@@ -69,7 +69,7 @@ extension Swift2JavaTranslator {
6969 enclosingType: try enclosingType. map { try SwiftType ( $0, symbolTable: symbolTable) } ,
7070 symbolTable: symbolTable
7171 )
72- return try CdeclLowering ( swiftStdlibTypes: swiftStdlibTypes) . lowerFunctionSignature ( signature, apiKind : isSet ? . setter : . getter )
72+ return try CdeclLowering ( swiftStdlibTypes: swiftStdlibTypes) . lowerFunctionSignature ( signature)
7373 }
7474}
7575
@@ -82,8 +82,7 @@ struct CdeclLowering {
8282 ///
8383 /// Throws an error if this function cannot be lowered for any reason.
8484 func lowerFunctionSignature(
85- _ signature: SwiftFunctionSignature ,
86- apiKind: SwiftAPIKind
85+ _ signature: SwiftFunctionSignature
8786 ) throws -> LoweredFunctionSignature {
8887 // Lower the self parameter.
8988 let loweredSelf : LoweredParameter ? = switch signature. selfParameter {
@@ -111,7 +110,6 @@ struct CdeclLowering {
111110
112111 return LoweredFunctionSignature (
113112 original: signature,
114- apiKind: apiKind,
115113 selfParameter: loweredSelf,
116114 parameters: loweredParameters,
117115 result: loweredResult
@@ -436,13 +434,6 @@ struct CdeclLowering {
436434 }
437435}
438436
439- package enum SwiftAPIKind {
440- case function
441- case initializer
442- case getter
443- case setter
444- }
445-
446437/// Represent a Swift parameter in the cdecl thunk.
447438struct LoweredParameter : Equatable {
448439 /// Lowered parameters in cdecl thunk.
@@ -487,8 +478,6 @@ extension LoweredResult {
487478public struct LoweredFunctionSignature : Equatable {
488479 var original : SwiftFunctionSignature
489480
490- var apiKind : SwiftAPIKind
491-
492481 var selfParameter : LoweredParameter ?
493482 var parameters : [ LoweredParameter ]
494483 var result : LoweredResult
@@ -520,9 +509,10 @@ public struct LoweredFunctionSignature: Equatable {
520509extension LoweredFunctionSignature {
521510 /// Produce the `@_cdecl` thunk for this lowered function signature that will
522511 /// call into the original function.
523- public func cdeclThunk(
512+ package func cdeclThunk(
524513 cName: String ,
525514 swiftAPIName: String ,
515+ as apiKind: SwiftAPIKind ,
526516 stdlibTypes: SwiftStandardLibraryTypes
527517 ) -> FunctionDeclSyntax {
528518
@@ -563,7 +553,7 @@ extension LoweredFunctionSignature {
563553
564554 // Build callee expression.
565555 let callee : ExprSyntax = if let selfExpr {
566- if case . initializer = self . apiKind {
556+ if case . initializer = apiKind {
567557 // Don't bother to create explicit ${Self}.init expression.
568558 selfExpr
569559 } else {
0 commit comments