1111public func _bjs_PlayBridgeJS_init( ) -> UnsafeMutableRawPointer {
1212 #if arch(wasm32)
1313 let ret = PlayBridgeJS ( )
14- return Unmanaged . passRetained ( ret) . toOpaque ( )
14+ return ret. bridgeJSLowerReturn ( )
1515 #else
1616 fatalError ( " Only available on WebAssembly " )
1717 #endif
1818}
1919
2020@_expose ( wasm, " bjs_PlayBridgeJS_update " )
2121@_cdecl ( " bjs_PlayBridgeJS_update " )
22- public func _bjs_PlayBridgeJS_update( _self: UnsafeMutableRawPointer , swiftSourceBytes: Int32 , swiftSourceLen : Int32 , dtsSourceBytes: Int32 , dtsSourceLen : Int32 ) -> UnsafeMutableRawPointer {
22+ public func _bjs_PlayBridgeJS_update( _self: UnsafeMutableRawPointer , swiftSourceBytes: Int32 , swiftSourceLength : Int32 , dtsSourceBytes: Int32 , dtsSourceLength : Int32 ) -> UnsafeMutableRawPointer {
2323 #if arch(wasm32)
2424 do {
25- let swiftSource = String ( unsafeUninitializedCapacity: Int ( swiftSourceLen) ) { b in
26- _swift_js_init_memory ( swiftSourceBytes, b. baseAddress. unsafelyUnwrapped)
27- return Int ( swiftSourceLen)
28- }
29- let dtsSource = String ( unsafeUninitializedCapacity: Int ( dtsSourceLen) ) { b in
30- _swift_js_init_memory ( dtsSourceBytes, b. baseAddress. unsafelyUnwrapped)
31- return Int ( dtsSourceLen)
32- }
33- let ret = try Unmanaged < PlayBridgeJS > . fromOpaque ( _self) . takeUnretainedValue ( ) . update ( swiftSource: swiftSource, dtsSource: dtsSource)
34- return Unmanaged . passRetained ( ret) . toOpaque ( )
25+ let ret = try PlayBridgeJS . bridgeJSLiftParameter ( _self) . update ( swiftSource: String . bridgeJSLiftParameter ( swiftSourceBytes, swiftSourceLength) , dtsSource: String . bridgeJSLiftParameter ( dtsSourceBytes, dtsSourceLength) )
26+ return ret. bridgeJSLowerReturn ( )
3527 } catch let error {
3628 if let error = error. thrownValue. object {
3729 withExtendedLifetime ( error) {
@@ -56,10 +48,16 @@ public func _bjs_PlayBridgeJS_deinit(pointer: UnsafeMutableRawPointer) {
5648 Unmanaged < PlayBridgeJS > . fromOpaque ( pointer) . release ( )
5749}
5850
59- extension PlayBridgeJS : ConvertibleToJSValue {
51+ extension PlayBridgeJS : ConvertibleToJSValue , _BridgedSwiftHeapObject {
6052 var jsValue : JSValue {
53+ #if arch(wasm32)
6154 @_extern ( wasm, module: " PlayBridgeJS " , name: " bjs_PlayBridgeJS_wrap " )
6255 func _bjs_PlayBridgeJS_wrap( _: UnsafeMutableRawPointer ) -> Int32
56+ #else
57+ func _bjs_PlayBridgeJS_wrap( _: UnsafeMutableRawPointer ) -> Int32 {
58+ fatalError ( " Only available on WebAssembly " )
59+ }
60+ #endif
6361 return . object( JSObject ( id: UInt32 ( bitPattern: _bjs_PlayBridgeJS_wrap ( Unmanaged . passRetained ( self ) . toOpaque ( ) ) ) ) )
6462 }
6563}
@@ -68,10 +66,8 @@ extension PlayBridgeJS: ConvertibleToJSValue {
6866@_cdecl ( " bjs_PlayBridgeJSOutput_outputJs " )
6967public func _bjs_PlayBridgeJSOutput_outputJs( _self: UnsafeMutableRawPointer ) -> Void {
7068 #if arch(wasm32)
71- var ret = Unmanaged < PlayBridgeJSOutput > . fromOpaque ( _self) . takeUnretainedValue ( ) . outputJs ( )
72- return ret. withUTF8 { ptr in
73- _swift_js_return_string ( ptr. baseAddress, Int32 ( ptr. count) )
74- }
69+ let ret = PlayBridgeJSOutput . bridgeJSLiftParameter ( _self) . outputJs ( )
70+ return ret. bridgeJSLowerReturn ( )
7571 #else
7672 fatalError ( " Only available on WebAssembly " )
7773 #endif
@@ -81,10 +77,8 @@ public func _bjs_PlayBridgeJSOutput_outputJs(_self: UnsafeMutableRawPointer) ->
8177@_cdecl ( " bjs_PlayBridgeJSOutput_outputDts " )
8278public func _bjs_PlayBridgeJSOutput_outputDts( _self: UnsafeMutableRawPointer ) -> Void {
8379 #if arch(wasm32)
84- var ret = Unmanaged < PlayBridgeJSOutput > . fromOpaque ( _self) . takeUnretainedValue ( ) . outputDts ( )
85- return ret. withUTF8 { ptr in
86- _swift_js_return_string ( ptr. baseAddress, Int32 ( ptr. count) )
87- }
80+ let ret = PlayBridgeJSOutput . bridgeJSLiftParameter ( _self) . outputDts ( )
81+ return ret. bridgeJSLowerReturn ( )
8882 #else
8983 fatalError ( " Only available on WebAssembly " )
9084 #endif
@@ -94,10 +88,8 @@ public func _bjs_PlayBridgeJSOutput_outputDts(_self: UnsafeMutableRawPointer) ->
9488@_cdecl ( " bjs_PlayBridgeJSOutput_importSwiftGlue " )
9589public func _bjs_PlayBridgeJSOutput_importSwiftGlue( _self: UnsafeMutableRawPointer ) -> Void {
9690 #if arch(wasm32)
97- var ret = Unmanaged < PlayBridgeJSOutput > . fromOpaque ( _self) . takeUnretainedValue ( ) . importSwiftGlue ( )
98- return ret. withUTF8 { ptr in
99- _swift_js_return_string ( ptr. baseAddress, Int32 ( ptr. count) )
100- }
91+ let ret = PlayBridgeJSOutput . bridgeJSLiftParameter ( _self) . importSwiftGlue ( )
92+ return ret. bridgeJSLowerReturn ( )
10193 #else
10294 fatalError ( " Only available on WebAssembly " )
10395 #endif
@@ -107,10 +99,8 @@ public func _bjs_PlayBridgeJSOutput_importSwiftGlue(_self: UnsafeMutableRawPoint
10799@_cdecl ( " bjs_PlayBridgeJSOutput_exportSwiftGlue " )
108100public func _bjs_PlayBridgeJSOutput_exportSwiftGlue( _self: UnsafeMutableRawPointer ) -> Void {
109101 #if arch(wasm32)
110- var ret = Unmanaged < PlayBridgeJSOutput > . fromOpaque ( _self) . takeUnretainedValue ( ) . exportSwiftGlue ( )
111- return ret. withUTF8 { ptr in
112- _swift_js_return_string ( ptr. baseAddress, Int32 ( ptr. count) )
113- }
102+ let ret = PlayBridgeJSOutput . bridgeJSLiftParameter ( _self) . exportSwiftGlue ( )
103+ return ret. bridgeJSLowerReturn ( )
114104 #else
115105 fatalError ( " Only available on WebAssembly " )
116106 #endif
@@ -122,10 +112,16 @@ public func _bjs_PlayBridgeJSOutput_deinit(pointer: UnsafeMutableRawPointer) {
122112 Unmanaged < PlayBridgeJSOutput > . fromOpaque ( pointer) . release ( )
123113}
124114
125- extension PlayBridgeJSOutput : ConvertibleToJSValue {
115+ extension PlayBridgeJSOutput : ConvertibleToJSValue , _BridgedSwiftHeapObject {
126116 var jsValue : JSValue {
117+ #if arch(wasm32)
127118 @_extern ( wasm, module: " PlayBridgeJS " , name: " bjs_PlayBridgeJSOutput_wrap " )
128119 func _bjs_PlayBridgeJSOutput_wrap( _: UnsafeMutableRawPointer ) -> Int32
120+ #else
121+ func _bjs_PlayBridgeJSOutput_wrap( _: UnsafeMutableRawPointer ) -> Int32 {
122+ fatalError ( " Only available on WebAssembly " )
123+ }
124+ #endif
129125 return . object( JSObject ( id: UInt32 ( bitPattern: _bjs_PlayBridgeJSOutput_wrap ( Unmanaged . passRetained ( self ) . toOpaque ( ) ) ) ) )
130126 }
131127}
0 commit comments