@@ -312,6 +312,31 @@ export async function createInstantiator(options, swift) {
312312 setException ( error ) ;
313313 }
314314 }
315+ TestModule [ "bjs_jsEchoJSValueArray" ] = function bjs_jsEchoJSValueArray ( ) {
316+ try {
317+ const arrayLen = tmpRetInts . pop ( ) ;
318+ const arrayResult = [ ] ;
319+ for ( let i = 0 ; i < arrayLen ; i ++ ) {
320+ const jsValuePayload2 = tmpRetF64s . pop ( ) ;
321+ const jsValuePayload1 = tmpRetInts . pop ( ) ;
322+ const jsValueKind = tmpRetInts . pop ( ) ;
323+ const jsValue = __bjs_jsValueLift ( jsValueKind , jsValuePayload1 , jsValuePayload2 ) ;
324+ arrayResult . push ( jsValue ) ;
325+ }
326+ arrayResult . reverse ( ) ;
327+ let ret = imports . jsEchoJSValueArray ( arrayResult ) ;
328+ const arrayCleanups = [ ] ;
329+ for ( const elem of ret ) {
330+ const [ elemKind , elemPayload1 , elemPayload2 ] = __bjs_jsValueLower ( elem ) ;
331+ tmpParamInts . push ( elemKind ) ;
332+ tmpParamInts . push ( elemPayload1 ) ;
333+ tmpParamF64s . push ( elemPayload2 ) ;
334+ }
335+ tmpParamInts . push ( ret . length ) ;
336+ } catch ( error ) {
337+ setException ( error ) ;
338+ }
339+ }
315340 } ,
316341 setInstance : ( i ) => {
317342 instance = i ;
@@ -448,6 +473,64 @@ export async function createInstantiator(options, swift) {
448473 }
449474 return optResult ;
450475 } ,
476+ roundTripJSValueArray : function bjs_roundTripJSValueArray ( values ) {
477+ const arrayCleanups = [ ] ;
478+ for ( const elem of values ) {
479+ const [ elemKind , elemPayload1 , elemPayload2 ] = __bjs_jsValueLower ( elem ) ;
480+ tmpParamInts . push ( elemKind ) ;
481+ tmpParamInts . push ( elemPayload1 ) ;
482+ tmpParamF64s . push ( elemPayload2 ) ;
483+ }
484+ tmpParamInts . push ( values . length ) ;
485+ instance . exports . bjs_roundTripJSValueArray ( ) ;
486+ const arrayLen = tmpRetInts . pop ( ) ;
487+ const arrayResult = [ ] ;
488+ for ( let i = 0 ; i < arrayLen ; i ++ ) {
489+ const jsValuePayload2 = tmpRetF64s . pop ( ) ;
490+ const jsValuePayload1 = tmpRetInts . pop ( ) ;
491+ const jsValueKind = tmpRetInts . pop ( ) ;
492+ const jsValue = __bjs_jsValueLift ( jsValueKind , jsValuePayload1 , jsValuePayload2 ) ;
493+ arrayResult . push ( jsValue ) ;
494+ }
495+ arrayResult . reverse ( ) ;
496+ for ( const cleanup of arrayCleanups ) { cleanup ( ) ; }
497+ return arrayResult ;
498+ } ,
499+ roundTripOptionalJSValueArray : function bjs_roundTripOptionalJSValueArray ( values ) {
500+ const isSome = values != null ;
501+ const valuesCleanups = [ ] ;
502+ if ( isSome ) {
503+ const arrayCleanups = [ ] ;
504+ for ( const elem of values ) {
505+ const [ elemKind , elemPayload1 , elemPayload2 ] = __bjs_jsValueLower ( elem ) ;
506+ tmpParamInts . push ( elemKind ) ;
507+ tmpParamInts . push ( elemPayload1 ) ;
508+ tmpParamF64s . push ( elemPayload2 ) ;
509+ }
510+ tmpParamInts . push ( values . length ) ;
511+ valuesCleanups . push ( ( ) => { for ( const cleanup of arrayCleanups ) { cleanup ( ) ; } } ) ;
512+ }
513+ instance . exports . bjs_roundTripOptionalJSValueArray ( + isSome ) ;
514+ const isSome1 = tmpRetInts . pop ( ) ;
515+ let optResult ;
516+ if ( isSome1 ) {
517+ const arrayLen = tmpRetInts . pop ( ) ;
518+ const arrayResult = [ ] ;
519+ for ( let i = 0 ; i < arrayLen ; i ++ ) {
520+ const jsValuePayload2 = tmpRetF64s . pop ( ) ;
521+ const jsValuePayload1 = tmpRetInts . pop ( ) ;
522+ const jsValueKind = tmpRetInts . pop ( ) ;
523+ const jsValue = __bjs_jsValueLift ( jsValueKind , jsValuePayload1 , jsValuePayload2 ) ;
524+ arrayResult . push ( jsValue ) ;
525+ }
526+ arrayResult . reverse ( ) ;
527+ optResult = arrayResult ;
528+ } else {
529+ optResult = null ;
530+ }
531+ for ( const cleanup of valuesCleanups ) { cleanup ( ) ; }
532+ return optResult ;
533+ } ,
451534 } ;
452535 _exports = exports ;
453536 return exports ;
0 commit comments