@@ -294,7 +294,7 @@ Object_await(Object *self) {
294294 wrapper -> asyncio_future_blocking = 0 ;
295295
296296 wrapper -> result = (EM_VAL )EM_ASM_INT ({
297- var value = emval_handle_array [ $0 ]. value ;
297+ var value = Emval . toValue ( $0 ) ;
298298 if (value && typeof value .then == = "function" ) {
299299 value .then (function (result ) {
300300 __py_notify_done ($1 , Emval .toHandle (result ));
@@ -324,7 +324,7 @@ Object_await(Object *self) {
324324static PyObject *
325325Object_repr (Object * self ) {
326326 char * str = (char * )EM_ASM_INT ({
327- var value = emval_handle_array [ $0 ]. value ;
327+ var value = Emval . toValue ( $0 ) ;
328328 var str = value .constructor ? value .constructor .name : 'Object' ;
329329 var len = lengthBytesUTF8 (str ) + 1 ;
330330 var buffer = _malloc (len );
@@ -351,7 +351,7 @@ Object_hash(Object *self) {
351351static PyObject *
352352Object_str (Object * self ) {
353353 char * str = (char * )EM_ASM_INT ({
354- var str = emval_handle_array [ $0 ]. value .toString ();
354+ var str = Emval . toValue ( $0 ) .toString ();
355355 var len = lengthBytesUTF8 (str ) + 1 ;
356356 var buffer = _malloc (len );
357357 stringToUTF8 (str , buffer , len );
@@ -369,7 +369,7 @@ Object_str(Object *self) {
369369static Py_ssize_t
370370Object_length (Object * self ) {
371371 int len = EM_ASM_INT ({
372- var val = emval_handle_array [ $0 ]. value ;
372+ var val = Emval . toValue ( $0 ) ;
373373 if (val [Symbol .iterator ] && val .length != = undefined ) {
374374 return val .length ;
375375 }
@@ -399,7 +399,7 @@ Object_getprop(Object *self, PyObject *item) {
399399
400400 EM_VAL result = (EM_VAL )EM_ASM_INT ({
401401 try {
402- return Emval .toHandle (emval_handle_array [ $0 ]. value [ emval_handle_array [ $1 ]. value ]);
402+ return Emval .toHandle (Emval . toValue ( $0 )[ Emval . toValue ( $1 ) ]);
403403 }
404404 catch (ex ) {
405405 return - Emval .toHandle (ex );
@@ -490,7 +490,7 @@ Object_richcompare(Object *self, PyObject *other, int op) {
490490static PyObject *
491491Object_iter (Object * self ) {
492492 EM_VAL val = (EM_VAL )EM_ASM_INT ({
493- var val = emval_handle_array [ $0 ]. value ;
493+ var val = Emval . toValue ( $0 ) ;
494494 if (val [Symbol .iterator ]) {
495495 return Emval .toHandle (val [Symbol .iterator ]());
496496 } else {
@@ -518,7 +518,7 @@ Object_iter(Object *self) {
518518static PyObject *
519519Object_next (Object * self ) {
520520 EM_VAL val = (EM_VAL )EM_ASM_INT ({
521- var val = emval_handle_array [ $0 ]. value ;
521+ var val = Emval . toValue ( $0 ) ;
522522 if (!val .next ) {
523523 return 0 ;
524524 }
@@ -545,7 +545,7 @@ static PyObject *
545545Object_dir (Object * self , PyObject * noarg ) {
546546 return emval_to_py ((EM_VAL )EM_ASM_INT ({
547547 var props = [];
548- for (var prop in emval_handle_array [ $0 ]. value ) {
548+ for (var prop in Emval . toValue ( $0 ) ) {
549549 props .push (prop );
550550 }
551551 return Emval .toHandle (props );
@@ -620,7 +620,7 @@ Function_call(Function *self, PyObject *args, PyObject *kwargs) {
620620 case 0 :
621621 result = (EM_VAL )EM_ASM_INT ({
622622 try {
623- return Emval .toHandle (emval_handle_array [ $0 ]. value . call (emval_handle_array [ $1 ]. value ));
623+ return Emval .toHandle (Emval . toValue ( $0 ). call (Emval . toValue ( $1 ) ));
624624 }
625625 catch (ex ) {
626626 return - Emval .toHandle (ex );
@@ -635,7 +635,7 @@ Function_call(Function *self, PyObject *args, PyObject *kwargs) {
635635 }
636636 result = (EM_VAL )EM_ASM_INT ({
637637 try {
638- return Emval .toHandle (emval_handle_array [ $0 ]. value . call (emval_handle_array [ $1 ]. value , emval_handle_array [ $2 ]. value ));
638+ return Emval .toHandle (Emval . toValue ( $0 ). call (Emval . toValue ( $1 ), Emval . toValue ( $2 ) ));
639639 }
640640 catch (ex ) {
641641 return - Emval .toHandle (ex );
@@ -668,9 +668,9 @@ Function_call(Function *self, PyObject *args, PyObject *kwargs) {
668668 for (var i = 0 ; i < $2 ; ++ i ) {
669669 var arg_handle = getValue ($3 + i * 4 , 'i32' );
670670 arg_handles .push (arg_handle );
671- arg_values .push (emval_handle_array [ arg_handle ]. value );
671+ arg_values .push (Emval . toValue ( arg_handle ) );
672672 }
673- return Emval .toHandle (emval_handle_array [ $0 ]. value . apply (emval_handle_array [ $1 ]. value , arg_values ));
673+ return Emval .toHandle (Emval . toValue ( $0 ). apply (Emval . toValue ( $1 ) , arg_values ));
674674 }
675675 catch (ex ) {
676676 return - Emval .toHandle (ex );
@@ -709,7 +709,7 @@ static PyTypeObject Function_Type = {
709709static PyObject *
710710Symbol_description (Symbol * self , void * unused ) {
711711 char * str = (char * )EM_ASM_INT ({
712- var str = emval_handle_array [ $0 ]. value .description ;
712+ var str = Emval . toValue ( $0 ) .description ;
713713 var len = lengthBytesUTF8 (str ) + 1 ;
714714 var buffer = _malloc (len );
715715 stringToUTF8 (str , buffer , len );
@@ -896,7 +896,7 @@ static EM_VAL py_to_emval(PyObject *val) {
896896 setValue (argv + i * 4 , Emval .toHandle (arguments [i ]), 'i32' );
897897 }
898898 var result = __py_call ($1 , $2 , Emval .toHandle (this ), argc , argv );
899- return emval_handle_array [ result ]. value ;
899+ return Emval . toValue ( result ) ;
900900 }
901901 });
902902 }, callback_id , func , self , max_args );
@@ -933,7 +933,7 @@ static PyObject *emval_to_py(EM_VAL handle) {
933933
934934 // Extract the message and the exception type.
935935 int type = EM_ASM_INT ({
936- var exc = emval_handle_array [ $0 ]. value ;
936+ var exc = Emval . toValue ( $0 ) ;
937937 try {
938938 if (exc .message ) {
939939 stringToUTF8 (exc .message , $1 , 512 );
@@ -978,7 +978,7 @@ static PyObject *emval_to_py(EM_VAL handle) {
978978 } target ;
979979
980980 int type = EM_ASM_INT (({
981- var value = emval_handle_array [ $0 ]. value ;
981+ var value = Emval . toValue ( $0 ) ;
982982 var type = typeof value ;
983983 if (type == = "number" ) {
984984 // Check whether it fits in an int.
@@ -1061,7 +1061,7 @@ browser_getattr(PyObject *self, PyObject *arg) {
10611061 }
10621062 EM_VAL result = (EM_VAL )EM_ASM_INT ({
10631063 try {
1064- return Emval .toHandle (window [emval_handle_array [ $0 ]. value ]);
1064+ return Emval .toHandle (window [Emval . toValue ( $0 ) ]);
10651065 }
10661066 catch (ex ) {
10671067 return - Emval .toHandle (ex );
0 commit comments