@@ -34,46 +34,42 @@ export async function createInstantiator(options, swift) {
3434
3535 let _exports = null ;
3636 let bjs = null ;
37- const __bjs_createConfigHelpers = ( ) => {
38- return ( ) => ( {
39- lower : ( value ) => {
40- const bytes = textEncoder . encode ( value . name ) ;
41- const id = swift . memory . retain ( bytes ) ;
42- i32Stack . push ( bytes . length ) ;
43- i32Stack . push ( id ) ;
44- i32Stack . push ( ( value . value | 0 ) ) ;
45- i32Stack . push ( value . enabled ? 1 : 0 ) ;
46- } ,
47- lift : ( ) => {
48- const bool = i32Stack . pop ( ) !== 0 ;
49- const int = i32Stack . pop ( ) ;
50- const string = strStack . pop ( ) ;
51- return { name : string , value : int , enabled : bool } ;
52- }
53- } ) ;
54- } ;
55- const __bjs_createMathOperationsHelpers = ( ) => {
56- return ( ) => ( {
57- lower : ( value ) => {
58- f64Stack . push ( value . baseValue ) ;
59- } ,
60- lift : ( ) => {
61- const f64 = f64Stack . pop ( ) ;
62- const instance1 = { baseValue : f64 } ;
63- instance1 . add = function ( a , b = 10.0 ) {
64- structHelpers . MathOperations . lower ( this ) ;
65- const ret = instance . exports . bjs_MathOperations_add ( a , b ) ;
66- return ret ;
67- } . bind ( instance1 ) ;
68- instance1 . multiply = function ( a , b ) {
69- structHelpers . MathOperations . lower ( this ) ;
70- const ret = instance . exports . bjs_MathOperations_multiply ( a , b ) ;
71- return ret ;
72- } . bind ( instance1 ) ;
73- return instance1 ;
74- }
75- } ) ;
76- } ;
37+ const __bjs_createConfigHelpers = ( ) => ( {
38+ lower : ( value ) => {
39+ const bytes = textEncoder . encode ( value . name ) ;
40+ const id = swift . memory . retain ( bytes ) ;
41+ i32Stack . push ( bytes . length ) ;
42+ i32Stack . push ( id ) ;
43+ i32Stack . push ( ( value . value | 0 ) ) ;
44+ i32Stack . push ( value . enabled ? 1 : 0 ) ;
45+ } ,
46+ lift : ( ) => {
47+ const bool = i32Stack . pop ( ) !== 0 ;
48+ const int = i32Stack . pop ( ) ;
49+ const string = strStack . pop ( ) ;
50+ return { name : string , value : int , enabled : bool } ;
51+ }
52+ } ) ;
53+ const __bjs_createMathOperationsHelpers = ( ) => ( {
54+ lower : ( value ) => {
55+ f64Stack . push ( value . baseValue ) ;
56+ } ,
57+ lift : ( ) => {
58+ const f64 = f64Stack . pop ( ) ;
59+ const instance1 = { baseValue : f64 } ;
60+ instance1 . add = function ( a , b = 10.0 ) {
61+ structHelpers . MathOperations . lower ( this ) ;
62+ const ret = instance . exports . bjs_MathOperations_add ( a , b ) ;
63+ return ret ;
64+ } . bind ( instance1 ) ;
65+ instance1 . multiply = function ( a , b ) {
66+ structHelpers . MathOperations . lower ( this ) ;
67+ const ret = instance . exports . bjs_MathOperations_multiply ( a , b ) ;
68+ return ret ;
69+ } . bind ( instance1 ) ;
70+ return instance1 ;
71+ }
72+ } ) ;
7773
7874 return {
7975 /**
@@ -343,7 +339,7 @@ export async function createInstantiator(options, swift) {
343339 const nameBytes = textEncoder . encode ( name ) ;
344340 const nameId = swift . memory . retain ( nameBytes ) ;
345341 const isSome = tag != null ;
346- let tagId , tagBytes ;
342+ let tagBytes , tagId ;
347343 if ( isSome ) {
348344 tagBytes = textEncoder . encode ( tag ) ;
349345 tagId = swift . memory . retain ( tagBytes ) ;
@@ -391,18 +387,18 @@ export async function createInstantiator(options, swift) {
391387 }
392388 set tag ( value ) {
393389 const isSome = value != null ;
394- let valueId , valueBytes ;
390+ let valueBytes , valueId ;
395391 if ( isSome ) {
396392 valueBytes = textEncoder . encode ( value ) ;
397393 valueId = swift . memory . retain ( valueBytes ) ;
398394 }
399395 instance . exports . bjs_ConstructorDefaults_tag_set ( this . pointer , + isSome , isSome ? valueId : 0 , isSome ? valueBytes . length : 0 ) ;
400396 }
401397 }
402- const ConfigHelpers = __bjs_createConfigHelpers ( ) ( ) ;
398+ const ConfigHelpers = __bjs_createConfigHelpers ( ) ;
403399 structHelpers . Config = ConfigHelpers ;
404400
405- const MathOperationsHelpers = __bjs_createMathOperationsHelpers ( ) ( ) ;
401+ const MathOperationsHelpers = __bjs_createMathOperationsHelpers ( ) ;
406402 structHelpers . MathOperations = MathOperationsHelpers ;
407403
408404 const exports = {
@@ -435,7 +431,7 @@ export async function createInstantiator(options, swift) {
435431 } ,
436432 testOptionalDefault : function bjs_testOptionalDefault ( name = null ) {
437433 const isSome = name != null ;
438- let nameId , nameBytes ;
434+ let nameBytes , nameId ;
439435 if ( isSome ) {
440436 nameBytes = textEncoder . encode ( name ) ;
441437 nameId = swift . memory . retain ( nameBytes ) ;
@@ -447,7 +443,7 @@ export async function createInstantiator(options, swift) {
447443 } ,
448444 testOptionalStringDefault : function bjs_testOptionalStringDefault ( greeting = "Hi" ) {
449445 const isSome = greeting != null ;
450- let greetingId , greetingBytes ;
446+ let greetingBytes , greetingId ;
451447 if ( isSome ) {
452448 greetingBytes = textEncoder . encode ( greeting ) ;
453449 greetingId = swift . memory . retain ( greetingBytes ) ;
@@ -485,12 +481,7 @@ export async function createInstantiator(options, swift) {
485481 i32Stack . push ( + isSome ) ;
486482 instance . exports . bjs_testOptionalStructDefault ( ) ;
487483 const isSome1 = i32Stack . pop ( ) ;
488- let optResult ;
489- if ( isSome1 ) {
490- optResult = structHelpers . Config . lift ( ) ;
491- } else {
492- optResult = null ;
493- }
484+ const optResult = isSome1 ? structHelpers . Config . lift ( ) : null ;
494485 return optResult ;
495486 } ,
496487 testOptionalStructWithValueDefault : function bjs_testOptionalStructWithValueDefault ( point = { name : "default" , value : 42 , enabled : true } ) {
@@ -501,12 +492,7 @@ export async function createInstantiator(options, swift) {
501492 i32Stack . push ( + isSome ) ;
502493 instance . exports . bjs_testOptionalStructWithValueDefault ( ) ;
503494 const isSome1 = i32Stack . pop ( ) ;
504- let optResult ;
505- if ( isSome1 ) {
506- optResult = structHelpers . Config . lift ( ) ;
507- } else {
508- optResult = null ;
509- }
495+ const optResult = isSome1 ? structHelpers . Config . lift ( ) : null ;
510496 return optResult ;
511497 } ,
512498 testIntArrayDefault : function bjs_testIntArrayDefault ( values = [ 1 , 2 , 3 ] ) {
0 commit comments