diff options
-rw-r--r-- | ports/webassembly/modjs.c | 2 | ||||
-rw-r--r-- | ports/webassembly/proxy_c.c | 2 | ||||
-rw-r--r-- | ports/webassembly/proxy_c.h | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/ports/webassembly/modjs.c b/ports/webassembly/modjs.c index bed09086a..5558a2cdd 100644 --- a/ports/webassembly/modjs.c +++ b/ports/webassembly/modjs.c @@ -35,7 +35,7 @@ void mp_module_js_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { mp_obj_jsproxy_t global_this; - global_this.ref = 0; + global_this.ref = MP_OBJ_JSPROXY_REF_GLOBAL_THIS; mp_obj_jsproxy_attr(MP_OBJ_FROM_PTR(&global_this), attr, dest); } diff --git a/ports/webassembly/proxy_c.c b/ports/webassembly/proxy_c.c index 00abc43bf..b7bc87b76 100644 --- a/ports/webassembly/proxy_c.c +++ b/ports/webassembly/proxy_c.c @@ -202,7 +202,7 @@ void proxy_convert_mp_to_js_obj_cside(mp_obj_t obj, uint32_t *out) { out[2] = (uintptr_t)str; } else if (obj == mp_const_undefined) { kind = PROXY_KIND_MP_JSPROXY; - out[1] = 1; + out[1] = MP_OBJ_JSPROXY_REF_UNDEFINED; } else if (mp_obj_is_jsproxy(obj)) { kind = PROXY_KIND_MP_JSPROXY; out[1] = mp_obj_jsproxy_get_ref(obj); diff --git a/ports/webassembly/proxy_c.h b/ports/webassembly/proxy_c.h index d3567c195..4ca2b8644 100644 --- a/ports/webassembly/proxy_c.h +++ b/ports/webassembly/proxy_c.h @@ -28,6 +28,10 @@ #include "py/obj.h" +// Fixed JsProxy references. +#define MP_OBJ_JSPROXY_REF_GLOBAL_THIS (0) +#define MP_OBJ_JSPROXY_REF_UNDEFINED (1) + // proxy value number of items #define PVN (3) |