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.

chore: clean up unused arguments

+33 -51
+2 -2
include/ant.h
··· 92 92 void *udata 93 93 ); 94 94 95 - const char *js_sym_desc(ant_t *js, ant_value_t sym); 95 + const char *js_sym_desc(ant_value_t sym); 96 96 const char *js_sym_key(ant_value_t sym); 97 97 98 98 ant_value_t js_mksym_for(ant_t *, const char *key); ··· 160 160 161 161 uint8_t vtype(ant_value_t val); 162 162 size_t vdata(ant_value_t val); 163 - bool js_is_constructor(ant_t *js, ant_value_t value); 163 + bool js_is_constructor(ant_value_t value); 164 164 165 165 ant_object_t *js_obj_ptr(ant_value_t val); 166 166 ant_value_t js_obj_from_ptr(ant_object_t *obj);
+1 -1
include/silver/engine.h
··· 631 631 return js_mkundef(); 632 632 } 633 633 634 - if (is_construct_call && !js_is_constructor(js, func)) 634 + if (is_construct_call && !js_is_constructor(func)) 635 635 return js_mkerr_typed(js, JS_ERR_TYPE, "not a constructor"); 636 636 637 637 if (!is_construct_call && vtype(func) == T_OBJ && is_proxy(func)) {
+25 -42
src/ant.c
··· 1998 1998 return cpy(buf, len, temp, strlen(temp)); 1999 1999 } 2000 2000 2001 - static inline ant_offset_t assert_flat_string_len(ant_t *js, ant_value_t value, const char **out_ptr) { 2002 - (void)js; 2001 + static inline ant_offset_t assert_flat_string_len(ant_value_t value, const char **out_ptr) { 2003 2002 ant_flat_string_t *flat = ant_str_flat_ptr(value); 2004 2003 assert(flat != NULL); 2005 2004 ant_offset_t len = flat->len; ··· 2075 2074 2076 2075 if (!str_is_heap_rope(str)) { 2077 2076 const char *sptr; 2078 - ant_offset_t slen = assert_flat_string_len(js, str, &sptr); 2077 + ant_offset_t slen = assert_flat_string_len(str, &sptr); 2079 2078 memcpy(dest + *pos, sptr, slen); 2080 2079 *pos += slen; return; 2081 2080 } ··· 2083 2082 ant_value_t cached = rope_cached_flat(str); 2084 2083 if (vtype(cached) == T_STR && !str_is_heap_rope(cached)) { 2085 2084 const char *cptr; 2086 - ant_offset_t clen = assert_flat_string_len(js, cached, &cptr); 2085 + ant_offset_t clen = assert_flat_string_len(cached, &cptr); 2087 2086 memcpy(dest + *pos, cptr, clen); 2088 2087 *pos += clen; return; 2089 2088 } ··· 2097 2096 2098 2097 if (!str_is_heap_rope(node)) { 2099 2098 const char *sptr; 2100 - ant_offset_t slen = assert_flat_string_len(js, node, &sptr); 2099 + ant_offset_t slen = assert_flat_string_len(node, &sptr); 2101 2100 memcpy(dest + *pos, sptr, slen); 2102 2101 *pos += slen; continue; 2103 2102 } ··· 2105 2104 ant_value_t c = rope_cached_flat(node); 2106 2105 if (vtype(c) == T_STR && !str_is_heap_rope(c)) { 2107 2106 const char *cptr; 2108 - ant_offset_t clen = assert_flat_string_len(js, c, &cptr); 2107 + ant_offset_t clen = assert_flat_string_len(c, &cptr); 2109 2108 memcpy(dest + *pos, cptr, clen); 2110 2109 *pos += clen; continue; 2111 2110 } ··· 2223 2222 } 2224 2223 2225 2224 const char *ptr = NULL; 2226 - ant_offset_t slen = assert_flat_string_len(js, value, &ptr); 2225 + ant_offset_t slen = assert_flat_string_len(value, &ptr); 2227 2226 if (len) *len = slen; 2228 2227 return (ant_offset_t)(uintptr_t)ptr; 2229 2228 } ··· 2438 2437 } 2439 2438 2440 2439 case T_SYMBOL: { 2441 - const char *desc = js_sym_desc(js, value); 2440 + const char *desc = js_sym_desc(value); 2442 2441 if (desc) return (size_t) snprintf(buf, len, "Symbol(%s)", desc); 2443 2442 return ANT_COPY(buf, len, "Symbol()"); 2444 2443 } ··· 4280 4279 return (ant_symbol_heap_t *)(uintptr_t)vdata(v); 4281 4280 } 4282 4281 4283 - static inline uint32_t sym_get_id(ant_t *js, ant_value_t v) { 4284 - (void)js; 4282 + static inline uint32_t sym_get_id(ant_value_t v) { 4285 4283 ant_symbol_heap_t *ptr = sym_ptr(v); 4286 4284 return ptr ? ptr->id : 0; 4287 4285 } 4288 4286 4289 - static inline uint32_t sym_get_flags(ant_t *js, ant_value_t v) { 4290 - (void)js; 4287 + static inline uint32_t sym_get_flags(ant_value_t v) { 4291 4288 ant_symbol_heap_t *ptr = sym_ptr(v); 4292 4289 return ptr ? ptr->flags : 0; 4293 4290 } 4294 4291 4295 - static inline uintptr_t sym_get_key_ptr(ant_t *js, ant_value_t v) { 4296 - (void)js; 4292 + static inline uintptr_t sym_get_key_ptr(ant_value_t v) { 4297 4293 ant_symbol_heap_t *ptr = sym_ptr(v); 4298 4294 return ptr ? (uintptr_t)ptr->key : 0; 4299 4295 } 4300 4296 4301 - static const char *sym_get_desc(ant_t *js, ant_value_t v) { 4302 - (void)js; 4303 - ant_symbol_heap_t *ptr = sym_ptr(v); 4297 + const inline char *js_sym_desc(ant_value_t sym) { 4298 + ant_symbol_heap_t *ptr = sym_ptr(sym); 4304 4299 if (!ptr || ptr->desc_len == 0) return NULL; 4305 4300 return ptr->desc; 4306 4301 } ··· 4334 4329 4335 4330 const char *js_sym_key(ant_value_t sym) { 4336 4331 if (vtype(sym) != T_SYMBOL) return NULL; 4337 - ant_t *js = rt->js; 4338 - uint32_t flags = sym_get_flags(js, sym); 4332 + uint32_t flags = sym_get_flags(sym); 4339 4333 if (!(flags & SYM_FLAG_GLOBAL) || (flags & SYM_FLAG_WELL_KNOWN)) return NULL; 4340 - return (const char *)sym_get_key_ptr(js, sym); 4341 - } 4342 - 4343 - const inline char *js_sym_desc(ant_t *js, ant_value_t sym) { 4344 - return sym_get_desc(js, sym); 4334 + return (const char *)sym_get_key_ptr(sym); 4345 4335 } 4346 4336 4347 4337 static inline bool streq(const char *buf, size_t len, const char *s, size_t n) { ··· 4791 4781 if (vtype(str) != T_STR) return 0; 4792 4782 if (str_is_heap_rope(str)) return rope_len(str); 4793 4783 if (str_is_heap_builder(str)) return builder_len(str); 4794 - return assert_flat_string_len(js, str, NULL); 4784 + return assert_flat_string_len(str, NULL); 4795 4785 } 4796 4786 4797 4787 ant_value_t do_string_op(ant_t *js, uint8_t op, ant_value_t l, ant_value_t r) { ··· 5206 5196 } 5207 5197 5208 5198 ant_value_t js_symbol_to_string(ant_t *js, ant_value_t sym) { 5209 - const char *desc = js_sym_desc(js, sym); 5199 + const char *desc = js_sym_desc(sym); 5210 5200 if (!desc) return js_mkstr(js, "Symbol()", 8); 5211 5201 5212 5202 size_t desc_len = strlen(desc); ··· 5714 5704 ant_value_t proto_setup = setup_func_prototype(js, bound); 5715 5705 if (is_err(proto_setup)) return proto_setup; 5716 5706 5717 - js_mark_constructor(bound_func, js_is_constructor(js, func)); 5707 + js_mark_constructor(bound_func, js_is_constructor(func)); 5718 5708 5719 5709 return bound; 5720 5710 } ··· 5794 5784 ant_value_t proto_setup = setup_func_prototype(js, bound); 5795 5785 5796 5786 if (is_err(proto_setup)) return proto_setup; 5797 - js_mark_constructor(bound_func, js_is_constructor(js, func)); 5787 + js_mark_constructor(bound_func, js_is_constructor(func)); 5798 5788 5799 5789 return bound; 5800 5790 } ··· 6964 6954 6965 6955 if (sym_key) { 6966 6956 sym_off = (ant_offset_t)vdata(prop); 6967 - const char *desc = js_sym_desc(js, prop); 6957 + const char *desc = js_sym_desc(prop); 6968 6958 prop_str = desc ? desc : "symbol"; 6969 6959 prop_len = (ant_offset_t)strlen(prop_str); 6970 6960 } else { ··· 7557 7547 7558 7548 bool is_sym = (vtype(key) == T_SYMBOL); 7559 7549 if (is_sym) { 7560 - const char *d = js_sym_desc(js, key); 7550 + const char *d = js_sym_desc(key); 7561 7551 key_str = d ? d : "symbol"; 7562 7552 key_len = (ant_offset_t)strlen(key_str); 7563 7553 } else if (vtype(key) == T_STR) { ··· 9881 9871 return ret; 9882 9872 } 9883 9873 9884 - static ant_value_t builtin_Array_isArray(ant_t *js, ant_value_t *args, int nargs) { 9885 - (void) js; 9874 + static ant_value_t builtin_Array_isArray(ant_params_t) { 9886 9875 if (nargs == 0) return mkval(T_BOOL, 0); 9887 9876 return mkval(T_BOOL, vtype(args[0]) == T_ARR ? 1 : 0); 9888 9877 } ··· 11886 11875 } 11887 11876 11888 11877 void js_promise_clear_await_coroutine(ant_t *js, ant_value_t promise, coroutine_t *coro) { 11889 - (void)js; 11890 11878 if (vtype(promise) != T_PROMISE || !coro) return; 11891 11879 11892 11880 ant_promise_state_t *pd = get_promise_data(js, promise, false); ··· 13330 13318 bool is_sym = (vtype(key) == T_SYMBOL); 13331 13319 13332 13320 if (is_sym) { 13333 - const char *d = js_sym_desc(js, key); 13321 + const char *d = js_sym_desc(key); 13334 13322 prop_name = d ? d : "symbol"; 13335 13323 prop_len = (ant_offset_t)strlen(prop_name); 13336 13324 } else if (vtype(key) == T_NUM) { ··· 13701 13689 return get_proxy_data(obj) != NULL; 13702 13690 } 13703 13691 13704 - static bool js_is_constructor_impl(ant_t *js, ant_value_t value) { 13705 - (void)js; 13692 + bool js_is_constructor(ant_value_t value) { 13706 13693 ant_value_t slow = value; 13707 13694 ant_value_t fast = value; 13708 13695 ··· 13736 13723 } 13737 13724 } 13738 13725 13739 - bool js_is_constructor(ant_t *js, ant_value_t value) { 13740 - return js_is_constructor_impl(js, value); 13741 - } 13742 - 13743 13726 static ant_value_t proxy_read_target(ant_t *js, ant_value_t obj) { 13744 13727 ant_proxy_state_t *data = get_proxy_data(obj); 13745 13728 return data ? data->target : obj; ··· 14186 14169 ant_value_t target = data->target; 14187 14170 ant_value_t handler = data->handler; 14188 14171 14189 - if (!js_is_constructor(js, target)) 14172 + if (!js_is_constructor(target)) 14190 14173 return js_mkerr_typed(js, JS_ERR_TYPE, "not a constructor"); 14191 14174 if (vtype(target) == T_OBJ && is_proxy(target)) 14192 14175 return js_proxy_construct(js, target, args, argc, new_target); ··· 14234 14217 data->revoked = false; 14235 14218 14236 14219 proxy_ptr->is_exotic = 1; 14237 - js_mark_constructor(proxy_obj, js_is_constructor(js, target)); 14220 + js_mark_constructor(proxy_obj, js_is_constructor(target)); 14238 14221 proxy_ptr->proxy_state = data; 14239 14222 return proxy_obj; 14240 14223 }
-1
src/errors.c
··· 450 450 } error_frame_errbuf_ctx_t; 451 451 452 452 static bool error_visit_frame_append_errbuf(ant_t *js, const js_vm_frame_view_t *view, void *ctx) { 453 - (void)js; 454 453 error_frame_errbuf_ctx_t *c = (error_frame_errbuf_ctx_t *)ctx; 455 454 *c->n = append_errbuf_fmt( 456 455 c->eb, *c->n,
+1 -1
src/modules/io.c
··· 836 836 } 837 837 838 838 if (t == T_SYMBOL) { 839 - const char *desc = js_sym_desc(js, val); 839 + const char *desc = js_sym_desc(val); 840 840 fprintf(stream, "Symbol(%s)", desc ? desc : ""); 841 841 return; 842 842 }
+1 -1
src/silver/glue.c
··· 915 915 916 916 if (vtype(func) == T_OBJ && is_proxy(func)) 917 917 return js_proxy_construct(js, func, args, argc, new_target); 918 - if (!js_is_constructor(js, func)) 918 + if (!js_is_constructor(func)) 919 919 return js_mkerr_typed(js, JS_ERR_TYPE, "not a constructor"); 920 920 921 921 ant_value_t proto = js_mkundef();
+2 -2
src/silver/ops/calls.h
··· 70 70 vm->stack[vm->sp++] = result; 71 71 return result; 72 72 } 73 - if (!js_is_constructor(js, func)) { 73 + if (!js_is_constructor(func)) { 74 74 vm->sp -= argc + 2; 75 75 return js_mkerr_typed(js, JS_ERR_TYPE, "not a constructor"); 76 76 } ··· 163 163 vm->stack[vm->sp++] = result; 164 164 return result; 165 165 } 166 - if (!js_is_constructor(js, func)) { 166 + if (!js_is_constructor(func)) { 167 167 sv_call_args_release(&call); 168 168 vm->sp -= argc + 2; 169 169 return js_mkerr_typed(js, JS_ERR_TYPE, "not a constructor");
+1 -1
src/silver/ops/property.h
··· 306 306 307 307 if (vtype(sym_prim) == T_SYMBOL && len == 11 && 308 308 memcmp(str, "description", 11) == 0) { 309 - const char *desc = js_sym_desc(js, sym_prim); 309 + const char *desc = js_sym_desc(sym_prim); 310 310 if (desc) return js_mkstr(js, desc, strlen(desc)); 311 311 return js_mkundef(); 312 312 }