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 pending target flush

+12 -2
+1
include/internal.h
··· 45 45 jsval_t this_val; // 'this' value for currently executing function 46 46 jsval_t super_val; // 'super' value for class methods 47 47 jsval_t new_target; // constructor called with 'new', undefined otherwise 48 + jsval_t pending_ntg; // staged new_target for next do_call_op 48 49 jsval_t module_ns; // current ESM module namespace 49 50 uint8_t *mem; // available JS memory 50 51 jsoff_t size; // memory size
+11 -2
src/ant.c
··· 8104 8104 8105 8105 uint8_t tok = js->tok, flags = js->flags; 8106 8106 jsval_t res = js_mkundef(); 8107 - 8107 + 8108 + jsval_t saved_new_target = js->new_target; 8109 + js->new_target = js->pending_ntg; 8110 + js->pending_ntg = js_mkundef(); 8111 + 8108 8112 if (vtype(func) == T_FUNC) { 8109 8113 jsval_t func_obj = mkval(T_OBJ, vdata(func)); 8110 8114 jsval_t cfunc_slot = get_slot(js, func_obj, SLOT_CFUNC); ··· 8219 8223 uint8_t st = vtype(super_ctor); 8220 8224 if (st == T_FUNC || st == T_CFUNC) { 8221 8225 js->code = code; js->clen = clen; js->pos = pos; 8226 + js->pending_ntg = js->new_target; 8222 8227 res = do_call_op(js, super_ctor, args); 8223 8228 js->super_val = saved_super; 8224 8229 js->current_func = saved_func; ··· 8341 8346 } 8342 8347 8343 8348 restore_state: 8349 + js->new_target = saved_new_target; 8344 8350 js->code = code, js->clen = clen, js->pos = pos; 8345 8351 js->flags = (flags & ~F_THROW) | (js->flags & F_THROW); 8346 8352 js->tok = tok; ··· 9879 9885 9880 9886 return mkval(T_FUNC, vdata(bound)); 9881 9887 } 9888 + js->pending_ntg = js->new_target; 9882 9889 return super_ctor; 9883 9890 } 9884 9891 ··· 10368 10375 if (is_err(ctor)) { return ctor; } 10369 10376 if (vtype(ctor) == T_PROP || vtype(ctor) == T_PROPREF) ctor = resolveprop(js, ctor); 10370 10377 if (vtype(obj) == T_OBJ && (vtype(ctor) == T_FUNC || vtype(ctor) == T_CFUNC)) set_slot(js, obj, SLOT_CTOR, ctor); 10371 - js->new_target = ctor; 10378 + js->pending_ntg = ctor; 10372 10379 10373 10380 jsval_t result; 10374 10381 push_this(obj); ··· 10376 10383 jsval_t params = js_call_params(js); 10377 10384 if (is_err(params)) { 10378 10385 pop_this(); 10386 + js->pending_ntg = js_mkundef(); 10379 10387 js->new_target = saved_new_target; return params; 10380 10388 } 10381 10389 result = do_op(js, TOK_CALL, ctor, params); ··· 22956 22964 js->this_val = js->scope; 22957 22965 js->super_val = js_mkundef(); 22958 22966 js->new_target = js_mkundef(); 22967 + js->pending_ntg = js_mkundef(); 22959 22968 js->errmsg_size = 4096; 22960 22969 js->errmsg = (char *)malloc(js->errmsg_size); 22961 22970 if (js->errmsg) js->errmsg[0] = '\0';