@@ -92,7 +92,7 @@ class CodeGenerator {
9292 }
9393
9494
95- var result : String = " \( swiftStruct. accessType) struct \( swiftStruct. name) : \( swiftStruct. parents. joined ( separator: " , " ) ) { \n "
95+ var result : String = " \( swiftStruct. accessType) struct \( swiftStruct. name) : \( swiftStruct. parents. joined ( separator: " , " ) ) , @unchecked Sendable {\n "
9696 for property in swiftStruct. properties {
9797 if let summary: String = property. summary { result. append ( " \( tab) /// \( checkComment ( summary) ) \n " ) }
9898 if let descr: String = property. description { result. append ( " \( tab) /// \( checkComment ( descr) ) \n " ) }
@@ -119,16 +119,6 @@ class CodeGenerator {
119119 return result
120120 }
121121
122- // public func decode_message_body(_ payload: TSDKParamsOfDecodeMessageBody,
123- // _ handler: @escaping (TSDKBindingResponse<TSDKDecodedMessageBody, TSDKClientError>) throws -> Void
124- // ) throws {
125- // let method: String = "decode_message_body"
126- // try binding.requestLibraryAsync(methodName(module, method), payload, { (requestId, params, responseType, finished) in
127- // var response: TSDKBindingResponse<TSDKDecodedMessageBody, TSDKClientError> = .init()
128- // response.update(requestId, params, responseType, finished)
129- // try handler(response)
130- // })
131- // }
132122 private func generateFunction( _ swiftFunction: SDKSwiftFunction ) -> String {
133123 var result : String = . init( )
134124 if let summary = swiftFunction. summary { result. append ( " \( tab) /// \( checkComment ( summary) ) \n " ) }
@@ -138,7 +128,7 @@ class CodeGenerator {
138128 result. append ( " _ \( parameter. name) : \( parameter. type) , " )
139129 }
140130 let resultType : String = swiftFunction. willReturn. type == " Void " ? " \( libPrefix) NoneResult " : swiftFunction. willReturn. type
141- result. append ( " _ handler: @escaping (TSDKBindingResponse< \( resultType) , \( libPrefix) ClientError>) throws -> Void \n \( tab) ) throws { \n " )
131+ result. append ( " _ handler: @escaping @Sendable (TSDKBindingResponse< \( resultType) , \( libPrefix) ClientError>) throws -> Void \n \( tab) ) throws { \n " )
142132 let methodName : String = swiftFunction. name == " initialize " ? " init " : swiftFunction. name
143133 result. append ( " \( tab) \( tab) let method: String = \" \( methodName) \" \n " )
144134 if swiftFunction. params. isEmpty {
@@ -155,27 +145,6 @@ class CodeGenerator {
155145 return result
156146 }
157147
158- // public func get_endpoints() async throws -> TSDKResultOfGetEndpoints {
159- // try await withCheckedThrowingContinuation { continuation in
160- // do {
161- // let method: String = "get_endpoints"
162- // try binding.requestLibraryAsync(methodName(module, method), "") { (requestId, params, responseType, finished) in
163- // var response: TSDKBindingResponse<TSDKResultOfGetEndpoints, TSDKClientError> = .init()
164- // response.update(requestId, params, responseType, finished)
165- // if let error = response.error {
166- // continuation.resume(throwing: error)
167- // } else if let result = response.result {
168- // continuation.resume(returning: result)
169- // } else {
170- // continuation.resume(throwing: TSDKClientError("Nothing for return"))
171- // }
172- // }
173- // } catch {
174- // continuation.resume(throwing: error)
175- // }
176- // }
177- // }
178-
179148 private func generateAsyncAwaitFunction( _ swiftFunction: SDKSwiftFunction ) -> String {
180149 var result : String = . init( )
181150 if let summary = swiftFunction. summary { result. append ( " \( tab) /// \( checkComment ( summary) ) \n " ) }
@@ -296,7 +265,7 @@ extension CodeGenerator {
296265 var swiftStruct = swiftStruct
297266 swiftStruct. parents. append ( " LocalizedError " )
298267
299- var result : String = " \( swiftStruct. accessType) struct \( swiftStruct. name) : \( swiftStruct. parents. joined ( separator: " , " ) ) { \n "
268+ var result : String = " \( swiftStruct. accessType) struct \( swiftStruct. name) : \( swiftStruct. parents. joined ( separator: " , " ) ) , @unchecked Sendable {\n "
300269 for property in swiftStruct. properties {
301270 if let summary: String = property. summary { result. append ( " \( tab) /// \( checkComment ( summary) ) \n " ) }
302271 if let descr: String = property. description { result. append ( " \( tab) /// \( checkComment ( descr) ) \n " ) }
0 commit comments