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.

if a class extends another, mark `SLOT_DEFAULT_CTOR` and delegate to `super` constructor in `do_call_op`.

+23 -3
+23 -3
src/ant.c
··· 657 657 return vtype(v) == T_UNDEF; 658 658 } 659 659 660 + static inline bool is_true(jsval_t v) { 661 + return vtype(v) == T_BOOL && vdata(v) != 0; 662 + } 663 + 664 + static inline bool is_false(jsval_t v) { 665 + return vtype(v) == T_BOOL && vdata(v) == 0; 666 + } 667 + 660 668 static inline uint8_t unhex(uint8_t c) { 661 669 return (c & 0xF) + (c >> 6) * 9; 662 670 } ··· 6485 6493 push_this(captured_this); 6486 6494 } 6487 6495 6496 + if (is_true(get_slot(js, func_obj, SLOT_DEFAULT_CTOR))) { 6497 + jsval_t super_ctor = js->super_val; 6498 + uint8_t st = vtype(super_ctor); 6499 + if (st == T_FUNC || st == T_CFUNC) { 6500 + js->code = code; js->clen = clen; js->pos = pos; 6501 + res = do_call_op(js, super_ctor, args); 6502 + js->super_val = saved_super; 6503 + js->current_func = saved_func; 6504 + pop_call_frame(); goto restore_state; 6505 + } 6506 + } 6507 + 6488 6508 jsval_t count_val = get_slot(js, func_obj, SLOT_FIELD_COUNT); 6489 6509 if (vtype(count_val) != T_NUM || vtype(target_this) != T_OBJ) goto skip_fields; 6490 6510 ··· 6541 6561 res = call_c(js, (jsval_t(*)(struct js *, jsval_t *, int)) vdata(func)); 6542 6562 } 6543 6563 6564 + restore_state: 6544 6565 js->code = code, js->clen = clen, js->pos = pos; 6545 6566 js->flags = (flags & ~F_THROW) | (js->flags & F_THROW); 6546 6567 js->tok = tok, js->nogc = nogc; ··· 11355 11376 jsoff_t code_len = constructor_body_end - constructor_params_start; 11356 11377 ctor_str = js_mkstr(js, &js->code[constructor_params_start], code_len); 11357 11378 } else { 11358 - if (super_len > 0) { 11359 - ctor_str = js_mkstr(js, "(...args){super(...args);}", 26); 11360 - } else ctor_str = js_mkstr(js, "(){}", 4); 11379 + ctor_str = js_mkstr(js, "(){}", 4); 11380 + if (super_len > 0) set_slot(js, func_obj, SLOT_DEFAULT_CTOR, js_mktrue()); 11361 11381 } 11362 11382 if (is_err(ctor_str)) return ctor_str; 11363 11383 set_slot(js, func_obj, SLOT_CODE, ctor_str);