@@ -76,7 +76,12 @@ export class SwiftRuntime {
7676 return this . _closureDeallocator ;
7777 }
7878
79- private callHostFunction ( host_func_id : number , line : number , file : string , args : any [ ] ) {
79+ private callHostFunction (
80+ host_func_id : number ,
81+ line : number ,
82+ file : string ,
83+ args : any [ ]
84+ ) {
8085 const argc = args . length ;
8186 const argv = this . exports . swjs_prepare_host_function_call ( argc ) ;
8287 for ( let index = 0 ; index < args . length ; index ++ ) {
@@ -103,7 +108,9 @@ export class SwiftRuntime {
103108 callback_func_ref
104109 ) ;
105110 if ( alreadyReleased ) {
106- throw new Error ( `The JSClosure has been already released by Swift side. The closure is created at ${ file } :${ line } ` ) ;
111+ throw new Error (
112+ `The JSClosure has been already released by Swift side. The closure is created at ${ file } :${ line } `
113+ ) ;
107114 }
108115 this . exports . swjs_cleanup_host_function_call ( argv ) ;
109116 return output ;
@@ -382,7 +389,11 @@ export class SwiftRuntime {
382389 return obj instanceof constructor ;
383390 } ,
384391
385- swjs_create_function : ( host_func_id : number , line : number , file : ref ) => {
392+ swjs_create_function : (
393+ host_func_id : number ,
394+ line : number ,
395+ file : ref
396+ ) => {
386397 const fileString = this . memory . getObject ( file ) as string ;
387398 const func = ( ...args : any [ ] ) =>
388399 this . callHostFunction ( host_func_id , line , fileString , args ) ;
@@ -436,5 +447,13 @@ export class SwiftRuntime {
436447 return BigInt . asIntN ( 64 , object ) ;
437448 }
438449 } ,
450+ swjs_i64_to_bigint_slow : ( lower , upper , signed ) => {
451+ const value =
452+ BigInt . asUintN ( 32 , BigInt ( lower ) ) +
453+ ( BigInt . asUintN ( 32 , BigInt ( upper ) ) << BigInt ( 32 ) ) ;
454+ return this . memory . retain (
455+ signed ? BigInt . asIntN ( 64 , value ) : BigInt . asUintN ( 64 , value )
456+ ) ;
457+ } ,
439458 } ;
440459}
0 commit comments