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.

export barrel

+9 -3
+9 -3
src/ant.c
··· 881 881 882 882 static jsval_t js_import_stmt(struct js *js); 883 883 static jsval_t js_export_stmt(struct js *js); 884 - 885 884 static jsval_t builtin_Object(struct js *js, jsval_t *args, int nargs); 886 885 static jsval_t builtin_promise_then(struct js *js, jsval_t *args, int nargs); 887 886 ··· 3773 3772 3774 3773 static inline jsval_t setprop(struct js *js, jsval_t obj, jsval_t k, jsval_t v) { 3775 3774 return js_setprop(js, obj, k, v); 3775 + } 3776 + 3777 + static inline void esm_export_binding(struct js *js, const char *exported, size_t exported_len, jsval_t value) { 3778 + jsval_t export_key = js_mkstr(js, exported, exported_len); 3779 + setprop(js, js->module_ns, export_key, value); 3780 + if (exported_len == 7 && strncmp(exported, "default", 7) == 0) js_set_slot(js, js->module_ns, SLOT_DEFAULT, value); 3776 3781 } 3777 3782 3778 3783 static inline jsval_t setprop_cstr(struct js *js, jsval_t obj, const char *key, size_t len, jsval_t v) { ··· 21223 21228 for (int i = 0; i < spec_count; i++) { 21224 21229 jsoff_t prop_off = lkp(js, ns, specs[i].local, specs[i].local_len); 21225 21230 jsval_t import_val = prop_off != 0 ? resolveprop(js, mkval(T_PROP, prop_off)) : js_mkundef(); 21226 - setprop(js, js->module_ns, js_mkstr(js, specs[i].exported, specs[i].export_len), import_val); 21231 + esm_export_binding(js, specs[i].exported, specs[i].export_len, import_val); 21227 21232 } 21228 21233 } else { 21229 21234 for (int i = 0; i < spec_count; i++) { 21230 21235 jsval_t local_val = lookup(js, specs[i].local, specs[i].local_len); 21231 21236 if (is_err(local_val)) return local_val; 21232 - setprop(js, js->module_ns, js_mkstr(js, specs[i].exported, specs[i].export_len), resolveprop(js, local_val)); 21237 + jsval_t export_val = resolveprop(js, local_val); 21238 + esm_export_binding(js, specs[i].exported, specs[i].export_len, export_val); 21233 21239 } 21234 21240 } 21235 21241