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.

add vtype support to inspect_value and inspect_object_full functions

+9 -4
+9 -4
src/modules/io.c
··· 524 524 } 525 525 526 526 static void inspect_value(struct js *js, jsval_t val, FILE *stream, int depth, inspect_visited_t *visited) { 527 - int t = js_type(val); 527 + int t = vtype(val); 528 528 529 529 if (t == T_UNDEF) { fprintf(stream, "undefined"); return; } 530 530 if (t == T_NULL) { fprintf(stream, "null"); return; } ··· 548 548 if (t == T_OBJ || t == T_FUNC || t == T_PROMISE || t == T_ARR) { 549 549 if (depth > 10) fprintf(stream, "<%s @%" PRIu64 " ...>", get_type_name(t), (uint64_t)vdata(val)); 550 550 else inspect_object_full(js, val, stream, depth, visited); 551 + return; 552 + } 553 + 554 + if (t == T_CFUNC) { 555 + fprintf(stream, "<native function 0x%" PRIx64 ">", (uint64_t)vdata(val)); 551 556 return; 552 557 } 553 558 ··· 555 560 } 556 561 557 562 static void inspect_object_full(struct js *js, jsval_t obj, FILE *stream, int depth, inspect_visited_t *visited) { 558 - int type = js_type(obj); 563 + int type = vtype(obj); 559 564 jsoff_t obj_off = (jsoff_t)vdata(obj); 560 565 561 566 if (inspect_was_visited(visited, obj_off)) { ··· 564 569 } 565 570 566 571 inspect_mark_visited(visited, obj_off); 567 - fprintf(stream, "<%s @%llu> {\n", type == JS_FUNC ? "Function" : (type == JS_PROMISE ? "Promise" : "Object"), (u64)obj_off); 572 + fprintf(stream, "<%s @%llu> {\n", type == T_FUNC ? "Function" : (type == T_PROMISE ? "Promise" : "Object"), (u64)obj_off); 568 573 569 574 int inner_depth = depth + 1; 570 575 ··· 573 578 574 579 for (int slot = SLOT_NONE + 1; slot < SLOT_MAX; slot++) { 575 580 jsval_t slot_val = js_get_slot(js, obj, (internal_slot_t)slot); 576 - int t = js_type(slot_val); 581 + int t = vtype(slot_val); 577 582 if (t == T_UNDEF) continue; 578 583 579 584 inspect_print_indent(stream, inner_depth + 1);