@@ -79,9 +79,9 @@ public func _bjs_roundTripJSObject(v: Int32) -> Int32 {
7979
8080@_expose ( wasm, " bjs_throwsSwiftError " )
8181@_cdecl ( " bjs_throwsSwiftError " )
82- public func _bjs_throwsSwiftError( ) -> Void {
82+ public func _bjs_throwsSwiftError( shouldThrow : Int32 ) -> Void {
8383 do {
84- try throwsSwiftError ( )
84+ try throwsSwiftError ( shouldThrow : shouldThrow == 1 )
8585 } catch let error {
8686 if let error = error. thrownValue. object {
8787 withExtendedLifetime ( error) {
@@ -97,6 +97,155 @@ public func _bjs_throwsSwiftError() -> Void {
9797 }
9898}
9999
100+ @_expose ( wasm, " bjs_throwsWithIntResult " )
101+ @_cdecl ( " bjs_throwsWithIntResult " )
102+ public func _bjs_throwsWithIntResult( ) -> Int32 {
103+ do {
104+ let ret = try throwsWithIntResult ( )
105+ return Int32 ( ret)
106+ } catch let error {
107+ if let error = error. thrownValue. object {
108+ withExtendedLifetime ( error) {
109+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
110+ }
111+ } else {
112+ let jsError = JSError ( message: String ( describing: error) )
113+ withExtendedLifetime ( jsError. jsObject) {
114+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
115+ }
116+ }
117+ return 0
118+ }
119+ }
120+
121+ @_expose ( wasm, " bjs_throwsWithStringResult " )
122+ @_cdecl ( " bjs_throwsWithStringResult " )
123+ public func _bjs_throwsWithStringResult( ) -> Void {
124+ do {
125+ var ret = try throwsWithStringResult ( )
126+ return ret. withUTF8 { ptr in
127+ _return_string ( ptr. baseAddress, Int32 ( ptr. count) )
128+ }
129+ } catch let error {
130+ if let error = error. thrownValue. object {
131+ withExtendedLifetime ( error) {
132+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
133+ }
134+ } else {
135+ let jsError = JSError ( message: String ( describing: error) )
136+ withExtendedLifetime ( jsError. jsObject) {
137+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
138+ }
139+ }
140+ return
141+ }
142+ }
143+
144+ @_expose ( wasm, " bjs_throwsWithBoolResult " )
145+ @_cdecl ( " bjs_throwsWithBoolResult " )
146+ public func _bjs_throwsWithBoolResult( ) -> Int32 {
147+ do {
148+ let ret = try throwsWithBoolResult ( )
149+ return Int32 ( ret ? 1 : 0 )
150+ } catch let error {
151+ if let error = error. thrownValue. object {
152+ withExtendedLifetime ( error) {
153+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
154+ }
155+ } else {
156+ let jsError = JSError ( message: String ( describing: error) )
157+ withExtendedLifetime ( jsError. jsObject) {
158+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
159+ }
160+ }
161+ return 0
162+ }
163+ }
164+
165+ @_expose ( wasm, " bjs_throwsWithFloatResult " )
166+ @_cdecl ( " bjs_throwsWithFloatResult " )
167+ public func _bjs_throwsWithFloatResult( ) -> Float32 {
168+ do {
169+ let ret = try throwsWithFloatResult ( )
170+ return Float32 ( ret)
171+ } catch let error {
172+ if let error = error. thrownValue. object {
173+ withExtendedLifetime ( error) {
174+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
175+ }
176+ } else {
177+ let jsError = JSError ( message: String ( describing: error) )
178+ withExtendedLifetime ( jsError. jsObject) {
179+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
180+ }
181+ }
182+ return 0.0
183+ }
184+ }
185+
186+ @_expose ( wasm, " bjs_throwsWithDoubleResult " )
187+ @_cdecl ( " bjs_throwsWithDoubleResult " )
188+ public func _bjs_throwsWithDoubleResult( ) -> Float64 {
189+ do {
190+ let ret = try throwsWithDoubleResult ( )
191+ return Float64 ( ret)
192+ } catch let error {
193+ if let error = error. thrownValue. object {
194+ withExtendedLifetime ( error) {
195+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
196+ }
197+ } else {
198+ let jsError = JSError ( message: String ( describing: error) )
199+ withExtendedLifetime ( jsError. jsObject) {
200+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
201+ }
202+ }
203+ return 0.0
204+ }
205+ }
206+
207+ @_expose ( wasm, " bjs_throwsWithSwiftHeapObjectResult " )
208+ @_cdecl ( " bjs_throwsWithSwiftHeapObjectResult " )
209+ public func _bjs_throwsWithSwiftHeapObjectResult( ) -> UnsafeMutableRawPointer {
210+ do {
211+ let ret = try throwsWithSwiftHeapObjectResult ( )
212+ return Unmanaged . passRetained ( ret) . toOpaque ( )
213+ } catch let error {
214+ if let error = error. thrownValue. object {
215+ withExtendedLifetime ( error) {
216+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
217+ }
218+ } else {
219+ let jsError = JSError ( message: String ( describing: error) )
220+ withExtendedLifetime ( jsError. jsObject) {
221+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
222+ }
223+ }
224+ return UnsafeMutableRawPointer ( bitPattern: - 1 ) . unsafelyUnwrapped
225+ }
226+ }
227+
228+ @_expose ( wasm, " bjs_throwsWithJSObjectResult " )
229+ @_cdecl ( " bjs_throwsWithJSObjectResult " )
230+ public func _bjs_throwsWithJSObjectResult( ) -> Int32 {
231+ do {
232+ let ret = try throwsWithJSObjectResult ( )
233+ return _swift_js_retain ( Int32 ( bitPattern: ret. id) )
234+ } catch let error {
235+ if let error = error. thrownValue. object {
236+ withExtendedLifetime ( error) {
237+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
238+ }
239+ } else {
240+ let jsError = JSError ( message: String ( describing: error) )
241+ withExtendedLifetime ( jsError. jsObject) {
242+ _swift_js_throw ( Int32 ( bitPattern: $0. id) )
243+ }
244+ }
245+ return 0
246+ }
247+ }
248+
100249@_expose ( wasm, " bjs_takeGreeter " )
101250@_cdecl ( " bjs_takeGreeter " )
102251public func _bjs_takeGreeter( g: UnsafeMutableRawPointer , nameBytes: Int32 , nameLen: Int32 ) -> Void {
0 commit comments