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.

use `vtype` instead of `js_type` for type checking

+5 -5
+2 -2
src/ant.c
··· 6475 6475 jsval_t bound_this = get_slot(js, func_obj, SLOT_BOUND_THIS); 6476 6476 6477 6477 jsval_t saved_this = js->this_val; 6478 - if (vtype(bound_this) != JS_UNDEF) { 6478 + if (vtype(bound_this) != T_UNDEF) { 6479 6479 push_this(bound_this); 6480 6480 js->this_val = bound_this; 6481 6481 } ··· 6487 6487 jsval_t result = fn(js, args, nargs); 6488 6488 6489 6489 js->current_func = saved_func; 6490 - if (vtype(bound_this) != JS_UNDEF) { 6490 + if (vtype(bound_this) != T_UNDEF) { 6491 6491 pop_this(); 6492 6492 js->this_val = saved_this; 6493 6493 }
+1 -1
src/modules/json.c
··· 109 109 static int should_skip_prop(struct js *js, const char *key, size_t key_len, jsval_t value) { 110 110 if (is_internal_prop(key, (jsoff_t)key_len)) return 1; 111 111 if (js_type(value) != JS_OBJ) return 0; 112 - return js_type(js_get_slot(js, value, SLOT_CODE)) == T_CFUNC; 112 + return vtype(js_get_slot(js, value, SLOT_CODE)) == T_CFUNC; 113 113 } 114 114 115 115 static prop_entry *collect_props(struct js *js, jsval_t val, int *out_count) {
+2 -2
src/modules/process.c
··· 683 683 static jsval_t process_hrtime(ant_t *js, jsval_t *args, int nargs) { 684 684 uint64_t now = uv_hrtime(); 685 685 686 - if (nargs > 0 && js_type(args[0]) == T_ARR) { 686 + if (nargs > 0 && vtype(args[0]) == T_ARR) { 687 687 jsval_t prev_sec = js_get(js, args[0], "0"); 688 688 jsval_t prev_nsec = js_get(js, args[0], "1"); 689 689 if (js_type(prev_sec) == JS_NUM && js_type(prev_nsec) == JS_NUM) { ··· 950 950 } 951 951 952 952 static jsval_t process_setgroups(ant_t *js, jsval_t *args, int nargs) { 953 - if (nargs < 1 || js_type(args[0]) != T_ARR) { 953 + if (nargs < 1 || vtype(args[0]) != T_ARR) { 954 954 return js_mkerr(js, "process.setgroups requires an array"); 955 955 } 956 956