MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

prevent nested exports from erroring

+9 -2
+1
include/common.h
··· 26 26 SLOT_TARGET_FUNC, 27 27 SLOT_NAME, 28 28 SLOT_MODULE_CTX, 29 + SLOT_MODULE_LOADING, 29 30 SLOT_MAP, 30 31 SLOT_SET, 31 32 SLOT_PRIMITIVE,
+2
src/esm/loader.c
··· 170 170 static ant_value_t esm_make_namespace_object(ant_t *js) { 171 171 ant_value_t ns = js_mkobj(js); 172 172 js_set_slot(ns, SLOT_BRAND, js_mknum(BRAND_MODULE_NAMESPACE)); 173 + js_set_slot(ns, SLOT_MODULE_LOADING, js_true); 173 174 return ns; 174 175 } 175 176 ··· 190 191 mod->default_export = esm_default_export_or_namespace(js, ns); 191 192 mod->is_loaded = true; 192 193 mod->is_loading = false; 194 + js_set_slot(ns, SLOT_MODULE_LOADING, js_mkundef()); 193 195 return ns; 194 196 } 195 197
+6 -2
src/silver/ops/coercion.h
··· 140 140 141 141 ant_value_t ns = vm->stack[vm->sp - 1]; 142 142 sv_atom_t *a = &func->atoms[atom_idx]; 143 - if (!sv_module_namespace_has_export(js, ns, a->str, a->len)) 144 - return sv_missing_named_export_error(js, ns, a->str, a->len); 143 + 144 + if ( 145 + !sv_module_namespace_has_export(js, ns, a->str, a->len) && 146 + js_get_slot(ns, SLOT_MODULE_LOADING) != js_true 147 + ) return sv_missing_named_export_error(js, ns, a->str, a->len); 145 148 146 149 ant_value_t value = js_get(js, ns, a->str); 147 150 if (is_err(value)) return value; 148 151 vm->stack[vm->sp - 1] = value; 152 + 149 153 return tov(0); 150 154 } 151 155