@@ -238,12 +238,9 @@ export async function createInstantiator(options, swift) {
238238 let ret = swift . memory . getObject ( self ) . stringOrNull ;
239239 const isSome = ret != null ;
240240 if ( isSome ) {
241- const bytes = textEncoder . encode ( ret ) ;
242- bjs [ "swift_js_return_optional_string" ] ( 1 , bytes , bytes . length ) ;
243- return bytes . length ;
241+ tmpRetString = ret ;
244242 } else {
245- bjs [ "swift_js_return_optional_string" ] ( 0 , 0 , 0 ) ;
246- return - 1 ;
243+ tmpRetString = null ;
247244 }
248245 } catch ( error ) {
249246 setException ( error ) ;
@@ -254,12 +251,9 @@ export async function createInstantiator(options, swift) {
254251 let ret = swift . memory . getObject ( self ) . stringOrUndefined ;
255252 const isSome = ret !== undefined ;
256253 if ( isSome ) {
257- const bytes = textEncoder . encode ( ret ) ;
258- bjs [ "swift_js_return_optional_string" ] ( 1 , bytes , bytes . length ) ;
259- return bytes . length ;
254+ tmpRetString = ret ;
260255 } else {
261- bjs [ "swift_js_return_optional_string" ] ( 0 , 0 , 0 ) ;
262- return - 1 ;
256+ tmpRetString = null ;
263257 }
264258 } catch ( error ) {
265259 setException ( error ) ;
@@ -395,12 +389,9 @@ export async function createInstantiator(options, swift) {
395389 let ret = swift . memory . getObject ( self ) . roundTripStringOrNull ( valueIsSome ? obj : null ) ;
396390 const isSome = ret != null ;
397391 if ( isSome ) {
398- const bytes = textEncoder . encode ( ret ) ;
399- bjs [ "swift_js_return_optional_string" ] ( 1 , bytes , bytes . length ) ;
400- return bytes . length ;
392+ tmpRetString = ret ;
401393 } else {
402- bjs [ "swift_js_return_optional_string" ] ( 0 , 0 , 0 ) ;
403- return - 1 ;
394+ tmpRetString = null ;
404395 }
405396 } catch ( error ) {
406397 setException ( error ) ;
@@ -416,12 +407,9 @@ export async function createInstantiator(options, swift) {
416407 let ret = swift . memory . getObject ( self ) . roundTripStringOrUndefined ( valueIsSome ? obj : undefined ) ;
417408 const isSome = ret !== undefined ;
418409 if ( isSome ) {
419- const bytes = textEncoder . encode ( ret ) ;
420- bjs [ "swift_js_return_optional_string" ] ( 1 , bytes , bytes . length ) ;
421- return bytes . length ;
410+ tmpRetString = ret ;
422411 } else {
423- bjs [ "swift_js_return_optional_string" ] ( 0 , 0 , 0 ) ;
424- return - 1 ;
412+ tmpRetString = null ;
425413 }
426414 } catch ( error ) {
427415 setException ( error ) ;
0 commit comments