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.

improve symbol usage

+9 -8
+2 -1
package.json
··· 2 2 "name": "ant", 3 3 "type": "module", 4 4 "scripts": { 5 - "spec": "./build/ant examples/spec/run.js" 5 + "spec": "./build/ant examples/spec/run.js", 6 + "wpt": "sh -c './build/ant tools/wpt/runner.js wpt/dom/$1.any.js' --" 6 7 }, 7 8 "dependencies": {}, 8 9 "devDependencies": {}
+1 -2
src/ant.c
··· 5052 5052 } 5053 5053 5054 5054 if (tx == T_BOOL) return vdata(x) == vdata(y) ? js_true : js_false; 5055 - 5056 - return x == y ? js_true : js_false; 5055 + return strict_eq_values(js, x, y) ? js_true : js_false; 5057 5056 } 5058 5057 5059 5058 enum obj_enum_mode {
+2 -2
src/modules/assert.c
··· 231 231 static ant_value_t assert_match(ant_t *js, ant_value_t *args, int nargs) { 232 232 if (nargs < 2) return js_mkundef(); 233 233 ant_value_t test_fn = js_getprop_fallback(js, args[1], "test"); 234 - if (vtype(test_fn) != T_FUNC) return js_mkerr(js, "assert.match: second argument must be a RegExp"); 234 + if (vtype(test_fn) != T_FUNC && vtype(test_fn) != T_CFUNC) return js_mkerr(js, "assert.match: second argument must be a RegExp"); 235 235 ant_value_t test_args[1] = {args[0]}; 236 236 ant_value_t result = sv_vm_call(js->vm, js, test_fn, args[1], test_args, 1, NULL, false); 237 237 if (!js_truthy(js, result)) ··· 242 242 static ant_value_t assert_does_not_match(ant_t *js, ant_value_t *args, int nargs) { 243 243 if (nargs < 2) return js_mkundef(); 244 244 ant_value_t test_fn = js_getprop_fallback(js, args[1], "test"); 245 - if (vtype(test_fn) != T_FUNC) return js_mkerr(js, "assert.doesNotMatch: second argument must be a RegExp"); 245 + if (vtype(test_fn) != T_FUNC && vtype(test_fn) != T_CFUNC) return js_mkerr(js, "assert.doesNotMatch: second argument must be a RegExp"); 246 246 ant_value_t test_args[1] = {args[0]}; 247 247 ant_value_t result = sv_vm_call(js->vm, js, test_fn, args[1], test_args, 1, NULL, false); 248 248 if (js_truthy(js, result))
+4
src/modules/math.c
··· 5 5 #include "errors.h" 6 6 #include "internal.h" 7 7 #include "runtime.h" 8 + 9 + #include "modules/symbol.h" 8 10 #include "modules/crypto.h" 9 11 10 12 #if DBL_MANT_DIG >= 64 ··· 327 329 js_setprop(js, math_obj, js_mkstr(js, "tan", 3), js_mkfun(builtin_Math_tan)); 328 330 js_setprop(js, math_obj, js_mkstr(js, "tanh", 4), js_mkfun(builtin_Math_tanh)); 329 331 js_setprop(js, math_obj, js_mkstr(js, "trunc", 5), js_mkfun(builtin_Math_trunc)); 332 + 333 + js_set_sym(js, math_obj, get_toStringTag_sym(), js_mkstr(js, "Math", 4)); 330 334 js_setprop(js, glob, js_mkstr(js, "Math", 4), math_obj); 331 335 }
-3
src/modules/symbol.c
··· 271 271 ant_value_t promise_proto = js_get(js, promise_ctor, "prototype"); 272 272 js_set_sym(js, promise_proto, g_toStringTag, js_mkstr(js, "Promise", 7)); 273 273 274 - ant_value_t math_obj = js_get(js, js_glob(js), "Math"); 275 - if (is_object_type(math_obj)) js_set_sym(js, math_obj, g_toStringTag, js_mkstr(js, "Math", 4)); 276 - 277 274 js_define_species_getter(js, promise_ctor); 278 275 js_define_species_getter(js, array_ctor); 279 276 }