@@ -15,19 +15,23 @@ import _CJavaScriptKit
1515
1616#if arch(wasm32)
1717@_extern ( wasm, module: " bjs " , name: " swift_js_throw " )
18- @ _spi ( BridgeJS ) public func _swift_js_throw ( _ id: Int32 )
18+ private func _swift_js_throw_extern ( _ id: Int32 )
1919#else
20+ private func _swift_js_throw_extern( _ id: Int32 ) {
21+ _onlyAvailableOnWasm ( )
22+ }
23+ #endif
24+
2025/// Throws a JavaScript exception from Swift code.
2126///
2227/// This function is called by the BridgeJS code generator when a Swift function throws
2328/// an error. The exception object is retained and stored for later retrieval by the
2429/// JavaScript-side runtime code.
2530///
2631/// - Parameter id: The ID of the JavaScript exception object to throw
27- @_spi( BridgeJS) public func _swift_js_throw ( _ id: Int32 ) {
28- _onlyAvailableOnWasm ( )
32+ @_spi ( BridgeJS) @ inline ( never ) public func _swift_js_throw( _ id: Int32 ) {
33+ _swift_js_throw_extern ( id )
2934}
30- #endif
3135
3236/// Retrieves and clears any pending JavaScript exception.
3337///
@@ -702,31 +706,43 @@ where Self: RawRepresentable, RawValue: _BridgedSwiftTypeLoweredIntoSingleWasmCo
702706
703707#if arch(wasm32)
704708@_extern ( wasm, module: " bjs " , name: " swift_js_init_memory " )
705- @ _spi ( BridgeJS ) public func _swift_js_init_memory ( _ sourceId: Int32 , _ ptr: UnsafeMutablePointer < UInt8 > )
709+ private func _swift_js_init_memory_extern ( _ sourceId: Int32 , _ ptr: UnsafeMutablePointer < UInt8 > )
706710#else
707- @_spi ( BridgeJS ) public func _swift_js_init_memory ( _ sourceId: Int32 , _ ptr: UnsafeMutablePointer < UInt8 > ) {
711+ private func _swift_js_init_memory_extern ( _ sourceId: Int32 , _ ptr: UnsafeMutablePointer < UInt8 > ) {
708712 _onlyAvailableOnWasm ( )
709713}
710714#endif
711715
716+ @_spi ( BridgeJS) @inline ( never) public func _swift_js_init_memory( _ sourceId: Int32 , _ ptr: UnsafeMutablePointer < UInt8 > ) {
717+ _swift_js_init_memory_extern ( sourceId, ptr)
718+ }
719+
712720#if arch(wasm32)
713721@_extern ( wasm, module: " bjs " , name: " swift_js_push_string " )
714- @ _spi ( BridgeJS ) public func _swift_js_push_string ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 )
722+ private func _swift_js_push_string_extern ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 )
715723#else
716- @_spi ( BridgeJS ) public func _swift_js_push_string ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
724+ private func _swift_js_push_string_extern ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
717725 _onlyAvailableOnWasm ( )
718726}
719727#endif
720728
729+ @_spi ( BridgeJS) @inline ( never) public func _swift_js_push_string( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
730+ _swift_js_push_string_extern ( ptr, len)
731+ }
732+
721733#if arch(wasm32)
722734@_extern ( wasm, module: " bjs " , name: " swift_js_push_i32 " )
723- @ _spi ( BridgeJS ) public func _swift_js_push_i32 ( _ value: Int32 )
735+ private func _swift_js_push_i32_extern ( _ value: Int32 )
724736#else
725- @_spi ( BridgeJS ) public func _swift_js_push_i32 ( _ value: Int32 ) {
737+ private func _swift_js_push_i32_extern ( _ value: Int32 ) {
726738 _onlyAvailableOnWasm ( )
727739}
728740#endif
729741
742+ @_spi ( BridgeJS) @inline ( never) public func _swift_js_push_i32( _ value: Int32 ) {
743+ _swift_js_push_i32_extern ( value)
744+ }
745+
730746#if arch(wasm32)
731747@_extern ( wasm, module: " bjs " , name: " swift_js_push_f32 " )
732748private func _swift_js_push_f32_extern( _ value: Float32 )
@@ -755,13 +771,17 @@ private func _swift_js_push_f64_extern(_ value: Float64) {
755771
756772#if arch(wasm32)
757773@_extern ( wasm, module: " bjs " , name: " swift_js_pop_i32 " )
758- @ _spi ( BridgeJS ) public func _swift_js_pop_i32 ( ) -> Int32
774+ private func _swift_js_pop_i32_extern ( ) -> Int32
759775#else
760- @ _spi ( BridgeJS ) public func _swift_js_pop_i32 ( ) -> Int32 {
776+ private func _swift_js_pop_i32_extern ( ) -> Int32 {
761777 _onlyAvailableOnWasm ( )
762778}
763779#endif
764780
781+ @_spi ( BridgeJS) @inline ( never) public func _swift_js_pop_i32( ) -> Int32 {
782+ _swift_js_pop_i32_extern ( )
783+ }
784+
765785#if arch(wasm32)
766786@_extern ( wasm, module: " bjs " , name: " swift_js_pop_f32 " )
767787private func _swift_js_pop_f32_extern( ) -> Float32
@@ -792,13 +812,17 @@ private func _swift_js_pop_f64_extern() -> Float64 {
792812
793813#if arch(wasm32)
794814@_extern ( wasm, module: " bjs " , name: " swift_js_struct_cleanup " )
795- @ _spi ( BridgeJS ) public func _swift_js_struct_cleanup ( _ cleanupId: Int32 )
815+ private func _swift_js_struct_cleanup_extern ( _ cleanupId: Int32 )
796816#else
797- @_spi ( BridgeJS ) public func _swift_js_struct_cleanup ( _ cleanupId: Int32 ) {
817+ private func _swift_js_struct_cleanup_extern ( _ cleanupId: Int32 ) {
798818 _onlyAvailableOnWasm ( )
799819}
800820#endif
801821
822+ @_spi ( BridgeJS) @inline ( never) public func _swift_js_struct_cleanup( _ cleanupId: Int32 ) {
823+ _swift_js_struct_cleanup_extern ( cleanupId)
824+ }
825+
802826// MARK: Wasm externs used by type lowering/lifting
803827
804828#if arch(wasm32)
@@ -986,13 +1010,17 @@ func _swift_js_return_optional_double(_ isSome: Int32, _ value: Float64) {
9861010
9871011#if arch(wasm32)
9881012@_extern ( wasm, module: " bjs " , name: " swift_js_push_pointer " )
989- @ _spi ( BridgeJS ) public func _swift_js_push_pointer ( _ pointer: UnsafeMutableRawPointer )
1013+ private func _swift_js_push_pointer_extern ( _ pointer: UnsafeMutableRawPointer )
9901014#else
991- @_spi ( BridgeJS ) public func _swift_js_push_pointer ( _ pointer: UnsafeMutableRawPointer ) {
1015+ private func _swift_js_push_pointer_extern ( _ pointer: UnsafeMutableRawPointer ) {
9921016 _onlyAvailableOnWasm ( )
9931017}
9941018#endif
9951019
1020+ @_spi ( BridgeJS) @inline ( never) public func _swift_js_push_pointer( _ pointer: UnsafeMutableRawPointer ) {
1021+ _swift_js_push_pointer_extern ( pointer)
1022+ }
1023+
9961024#if arch(wasm32)
9971025@_extern ( wasm, module: " bjs " , name: " swift_js_pop_pointer " )
9981026private func _swift_js_pop_pointer_extern( ) -> UnsafeMutableRawPointer
0 commit comments