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.

fix regression in SLOT_STRICT_ARGS

+28 -18
+23 -15
src/ant.c
··· 9171 9171 const char *that_ptr = (char *)(uintptr_t)(that_off); 9172 9172 9173 9173 int result = strcoll(str_ptr, that_ptr); 9174 - if (result < 0) return tov(-1); 9175 - if (result > 0) return tov(1); 9174 + if (result < 0) return tov(-1.0); 9175 + if (result > 0) return tov(1.0); 9176 + 9176 9177 return tov(0); 9177 9178 } 9178 9179 ··· 13108 13109 } 13109 13110 13110 13111 if (array_obj_ptr(obj)) { 13111 - if (((key_len == 6 && memcmp(key, "callee", 6) == 0) || 13112 - (key_len == 6 && memcmp(key, "caller", 6) == 0)) && 13113 - vtype(get_slot(obj, SLOT_STRICT_ARGS)) != T_UNDEF) { 13114 - *out = js_mkerr_typed(js, JS_ERR_TYPE, 13115 - "'%.*s' not allowed on strict arguments", 13116 - (int)key_len, key); 13112 + if ( 13113 + ((key_len == 6 && memcmp(key, "callee", 6) == 0) || 13114 + (key_len == 6 && memcmp(key, "caller", 6) == 0)) && 13115 + get_slot(obj, SLOT_STRICT_ARGS) == js_true 13116 + ) { 13117 + *out = js_mkerr_typed(js, JS_ERR_TYPE, "'%.*s' not allowed on strict arguments", (int)key_len, key); 13117 13118 return true; 13118 13119 } 13119 13120 ··· 13121 13122 *out = tov((double)get_array_length(js, obj)); 13122 13123 return true; 13123 13124 } 13125 + 13124 13126 unsigned long idx; 13125 13127 ant_offset_t arr_len = get_array_length(js, obj); 13128 + 13126 13129 if (parse_array_index(key, key_len, arr_len, &idx)) { 13127 13130 if (arr_has(js, obj, (ant_offset_t)idx)) { 13128 13131 *out = arr_get(js, obj, (ant_offset_t)idx); 13129 13132 return true; 13130 - } return false; 13133 + } 13134 + 13135 + return false; 13131 13136 } 13132 13137 13133 13138 ant_value_t arr_obj = js_as_obj(obj); 13134 13139 ant_offset_t off = lkp(js, arr_obj, key, key_len); 13140 + 13135 13141 if (off == 0) { 13136 13142 ant_value_t accessor_result; 13137 13143 if (try_accessor_getter(js, arr_obj, key, key_len, &accessor_result)) { 13138 13144 *out = accessor_result; return true; 13139 - } return false; 13145 + } 13146 + 13147 + return false; 13140 13148 } 13141 13149 13142 13150 const ant_shape_prop_t *prop_meta = prop_shape_meta(js, off); 13143 13151 if (prop_meta && prop_meta->has_getter) { 13144 - ant_value_t accessor_result; 13145 - if (try_accessor_getter(js, arr_obj, key, key_len, &accessor_result)) { 13146 - *out = accessor_result; return true; 13147 - } 13148 - } 13152 + ant_value_t accessor_result; 13153 + if (try_accessor_getter(js, arr_obj, key, key_len, &accessor_result)) { 13154 + *out = accessor_result; 13155 + return true; 13156 + }} 13149 13157 13150 13158 *out = propref_load(js, off); 13151 13159 return true;
+1 -1
src/modules/regex.c
··· 725 725 if (sticky_flag) match_options |= PCRE2_ANCHORED; 726 726 727 727 int rc; 728 - if (compiled.jit_ready) { 728 + if (compiled.jit_ready && !sticky_flag) { 729 729 rc = pcre2_jit_match(compiled.code, (PCRE2_SPTR)str_ptr, str_len, start_offset, match_options, compiled.match_data, NULL); 730 730 } else rc = pcre2_match(compiled.code, (PCRE2_SPTR)str_ptr, str_len, start_offset, match_options, compiled.match_data, NULL); 731 731
+1 -1
src/modules/util.c
··· 257 257 ant_value_t callee = js_mkundef(); 258 258 259 259 if (vtype(value) != T_ARR) return false; 260 - if (vtype(js_get_slot(value, SLOT_STRICT_ARGS)) != T_UNDEF) return true; 260 + if (js_get_slot(value, SLOT_STRICT_ARGS) == js_true) return true; 261 261 if (!util_has_to_string_tag(js, value, "Arguments", 9)) return false; 262 262 263 263 return js_try_get_own_data_prop(js, value, "callee", 6, &callee);
+3 -1
src/silver/ops/coercion.h
··· 361 361 if (frame->bp && frame->argc > 0) { 362 362 for (int i = 0; i < frame->argc; i++) js_arr_push(js, arr, frame->bp[i]); 363 363 } 364 - if (vtype(frame->callee) == T_FUNC) setprop_cstr(js, arr, "callee", 6, frame->callee); 364 + 365 + if (sv_frame_is_strict(frame)) js_set_slot(arr, SLOT_STRICT_ARGS, js_true); 366 + else if (vtype(frame->callee) == T_FUNC) setprop_cstr(js, arr, "callee", 6, frame->callee); 365 367 366 368 js_set_sym(js, arr, get_toStringTag_sym(), js_mkstr(js, "Arguments", 9)); 367 369 ant_value_t array_proto = js_get_ctor_proto(js, "Array", 5);