@@ -5571,7 +5571,7 @@ static void mark_children(JSRuntime *rt, JSGCObjectHeader *gp,
5571
5571
for (i = 0; i < b->ic->count; i++) {
5572
5572
shapes = &b->ic->cache[i].shape;
5573
5573
for (shape = *shapes; shape != endof(*shapes); shape++)
5574
- if (*shape)
5574
+ if (*shape)
5575
5575
mark_func(rt, &(*shape)->header);
5576
5576
}
5577
5577
}
@@ -7217,8 +7217,8 @@ JSValue JS_GetPropertyInternal(JSContext *ctx, JSValue obj,
7217
7217
7218
7218
static JSValue JS_GetPropertyInternalWithIC(JSContext *ctx, JSValue obj,
7219
7219
JSAtom prop, JSValue this_obj,
7220
- JSInlineCache *ic, int32_t offset,
7221
- BOOL throw_ref_error)
7220
+ JSInlineCache *ic, int32_t offset,
7221
+ BOOL throw_ref_error)
7222
7222
{
7223
7223
uint32_t tag;
7224
7224
JSObject *p;
@@ -7230,7 +7230,7 @@ static JSValue JS_GetPropertyInternalWithIC(JSContext *ctx, JSValue obj,
7230
7230
if (likely(offset >= 0))
7231
7231
return js_dup(p->prop[offset].u.value);
7232
7232
slow_path:
7233
- return JS_GetPropertyInternal2(ctx, obj, prop, this_obj, ic, throw_ref_error);
7233
+ return JS_GetPropertyInternal2(ctx, obj, prop, this_obj, ic, throw_ref_error);
7234
7234
}
7235
7235
7236
7236
static JSValue JS_ThrowTypeErrorPrivateNotFound(JSContext *ctx, JSAtom atom)
@@ -15718,7 +15718,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValue func_obj,
15718
15718
}
15719
15719
BREAK;
15720
15720
15721
- CASE(OP_get_field_ic):
15721
+ CASE(OP_get_field_ic):
15722
15722
{
15723
15723
JSValue val;
15724
15724
JSAtom atom;
@@ -15801,7 +15801,7 @@ static JSValue JS_CallInternal(JSContext *caller_ctx, JSValue func_obj,
15801
15801
atom = get_ic_atom(ic, ic_offset);
15802
15802
pc += 4;
15803
15803
ret = JS_SetPropertyInternalWithIC(ctx, sp[-2], atom, sp[-1], JS_PROP_THROW_STRICT, ic, ic_offset);
15804
- ic->updated = FALSE;
15804
+ ic->updated = FALSE;
15805
15805
JS_FreeValue(ctx, sp[-2]);
15806
15806
sp -= 2;
15807
15807
if (unlikely(ret < 0))
@@ -25275,7 +25275,7 @@ static int add_req_module_entry(JSContext *ctx, JSModuleDef *m,
25275
25275
return i;
25276
25276
}
25277
25277
25278
- static JSExportEntry *find_export_entry(JSContext *ctx, JSModuleDef *m,
25278
+ static JSExportEntry *find_export_entry(JSContext *ctx, const JSModuleDef *m,
25279
25279
JSAtom export_name)
25280
25280
{
25281
25281
JSExportEntry *me;
@@ -34394,6 +34394,37 @@ int JS_SetModuleExportList(JSContext *ctx, JSModuleDef *m,
34394
34394
return 0;
34395
34395
}
34396
34396
34397
+ JSValue JS_GetModuleExport(JSContext *ctx, const JSModuleDef *m, const char *export_name) {
34398
+ JSExportEntry *me;
34399
+ JSAtom name;
34400
+ name = JS_NewAtom(ctx, export_name);
34401
+ if (name == JS_ATOM_NULL)
34402
+ goto fail;
34403
+ me = find_export_entry(ctx, m, name);
34404
+ JS_FreeAtom(ctx, name);
34405
+ if (!me)
34406
+ goto fail;
34407
+ return JS_DupValue(ctx, me->u.local.var_ref->value);
34408
+ fail:
34409
+ return JS_UNDEFINED;
34410
+ }
34411
+
34412
+ int JS_CountModuleExport(JSContext *ctx, const JSModuleDef *m) {
34413
+ return m->export_entries_count;
34414
+ }
34415
+
34416
+ JSAtom JS_GetModuleExportName(JSContext *ctx, const JSModuleDef *m, int idx) {
34417
+ if (idx >= m->export_entries_count || idx < 0)
34418
+ return JS_ATOM_NULL;
34419
+ return JS_DupAtom(ctx, m->export_entries[idx].export_name);
34420
+ }
34421
+
34422
+ JSValue JS_GetModuleExportValue(JSContext *ctx, const JSModuleDef *m, int idx) {
34423
+ if (idx >= m->export_entries_count || idx < 0)
34424
+ return JS_UNDEFINED;
34425
+ return JS_DupValue(ctx, m->export_entries[idx].u.local.var_ref->value);
34426
+ }
34427
+
34397
34428
/* Note: 'func_obj' is not necessarily a constructor */
34398
34429
static void JS_SetConstructor2(JSContext *ctx,
34399
34430
JSValue func_obj,
0 commit comments