My working unpac space for OCaml projects in development
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

added regexp duplicate named groups - fixed reset of captures with quantizers

+235 -111
+1
vendor/git/quickjs-c/Changelog
··· 6 6 - added Atomics.pause 7 7 - added added Map and WeakMap upsert methods 8 8 - added Math.sumPrecise() 9 + - added regexp duplicate named groups 9 10 - misc bug fixes 10 11 11 12 2025-09-13:
+1 -1
vendor/git/quickjs-c/TODO
··· 63 63 Test262o commit: 7da91bceb9ce7613f87db47ddd1292a2dda58b42 (es5-tests branch) 64 64 65 65 Test262: 66 - Result: 72/83257 errors, 2590 excluded, 5786 skipped 66 + Result: 66/83295 errors, 2590 excluded, 5767 skipped
+1 -1
vendor/git/quickjs-c/libregexp-opcode.h
··· 54 54 DEF(word_boundary_i, 1) 55 55 DEF(not_word_boundary, 1) 56 56 DEF(not_word_boundary_i, 1) 57 - DEF(back_reference, 2) 57 + DEF(back_reference, 2) /* variable length */ 58 58 DEF(back_reference_i, 2) /* must come after */ 59 59 DEF(backward_back_reference, 2) /* must come after */ 60 60 DEF(backward_back_reference_i, 2) /* must come after */
+194 -85
vendor/git/quickjs-c/libregexp.c
··· 77 77 BOOL ignore_case; 78 78 BOOL multi_line; 79 79 BOOL dotall; 80 + uint8_t group_name_scope; 80 81 int capture_count; 81 82 int total_capture_count; /* -1 = not computed yet */ 82 83 int has_named_captures; /* -1 = don't know, 0 = no, 1 = yes */ ··· 478 479 if (i != 1) 479 480 printf(","); 480 481 printf("<%s>", p); 481 - p += strlen(p) + 1; 482 + p += strlen(p) + LRE_GROUP_NAME_TRAILER_LEN; 482 483 } 483 484 printf("\n"); 484 485 assert(p == (char *)(buf + buf_len)); ··· 547 548 break; 548 549 case REOP_save_start: 549 550 case REOP_save_end: 551 + printf(" %u", buf[pos + 1]); 552 + break; 550 553 case REOP_back_reference: 551 554 case REOP_back_reference_i: 552 555 case REOP_backward_back_reference: 553 556 case REOP_backward_back_reference_i: 554 - printf(" %u", buf[pos + 1]); 557 + { 558 + int n, i; 559 + n = buf[pos + 1]; 560 + len += n; 561 + for(i = 0; i < n; i++) { 562 + if (i != 0) 563 + printf(","); 564 + printf(" %u", buf[pos + 2 + i]); 565 + } 566 + } 555 567 break; 556 568 case REOP_save_reset: 557 569 printf(" %u %u", buf[pos + 1], buf[pos + 2]); ··· 1531 1543 return -1; 1532 1544 } 1533 1545 1534 - /* Return: 1535 - - true if the opcodes may not advance the char pointer 1536 - - false if the opcodes always advance the char pointer 1546 + /* need_check_adv: false if the opcodes always advance the char pointer 1547 + need_capture_init: true if all the captures in the atom are not set 1537 1548 */ 1538 - static BOOL re_need_check_advance(const uint8_t *bc_buf, int bc_buf_len) 1549 + static BOOL re_need_check_adv_and_capture_init(BOOL *pneed_capture_init, 1550 + const uint8_t *bc_buf, int bc_buf_len) 1539 1551 { 1540 1552 int pos, opcode, len; 1541 1553 uint32_t val; 1542 - BOOL ret; 1554 + BOOL need_check_adv, need_capture_init; 1543 1555 1544 - ret = TRUE; 1556 + need_check_adv = TRUE; 1557 + need_capture_init = FALSE; 1545 1558 pos = 0; 1546 1559 while (pos < bc_buf_len) { 1547 1560 opcode = bc_buf[pos]; ··· 1551 1564 case REOP_range_i: 1552 1565 val = get_u16(bc_buf + pos + 1); 1553 1566 len += val * 4; 1554 - goto simple_char; 1567 + need_check_adv = FALSE; 1568 + break; 1555 1569 case REOP_range32: 1556 1570 case REOP_range32_i: 1557 1571 val = get_u16(bc_buf + pos + 1); 1558 1572 len += val * 8; 1559 - goto simple_char; 1573 + need_check_adv = FALSE; 1574 + break; 1560 1575 case REOP_char: 1561 1576 case REOP_char_i: 1562 1577 case REOP_char32: 1563 1578 case REOP_char32_i: 1564 1579 case REOP_dot: 1565 1580 case REOP_any: 1566 - simple_char: 1567 - ret = FALSE; 1581 + need_check_adv = FALSE; 1568 1582 break; 1569 1583 case REOP_line_start: 1570 1584 case REOP_line_start_m: ··· 1582 1596 case REOP_save_start: 1583 1597 case REOP_save_end: 1584 1598 case REOP_save_reset: 1599 + break; 1585 1600 case REOP_back_reference: 1586 1601 case REOP_back_reference_i: 1587 1602 case REOP_backward_back_reference: 1588 1603 case REOP_backward_back_reference_i: 1604 + val = bc_buf[pos + 1]; 1605 + len += val; 1606 + need_capture_init = TRUE; 1589 1607 break; 1590 1608 default: 1591 1609 /* safe behavior: we cannot predict the outcome */ 1592 - return TRUE; 1610 + need_capture_init = TRUE; 1611 + goto done; 1593 1612 } 1594 1613 pos += len; 1595 1614 } 1596 - return ret; 1615 + done: 1616 + *pneed_capture_init = need_capture_init; 1617 + return need_check_adv; 1597 1618 } 1598 1619 1599 1620 /* '*pp' is the first char after '<' */ ··· 1652 1673 } 1653 1674 1654 1675 /* if capture_name = NULL: return the number of captures + 1. 1655 - Otherwise, return the capture index corresponding to capture_name 1656 - or -1 if none */ 1676 + Otherwise, return the number of matching capture groups */ 1657 1677 static int re_parse_captures(REParseState *s, int *phas_named_captures, 1658 - const char *capture_name) 1678 + const char *capture_name, BOOL emit_group_index) 1659 1679 { 1660 1680 const uint8_t *p; 1661 - int capture_index; 1681 + int capture_index, n; 1662 1682 char name[TMP_BUF_SIZE]; 1663 1683 1664 1684 capture_index = 1; 1685 + n = 0; 1665 1686 *phas_named_captures = 0; 1666 1687 for (p = s->buf_start; p < s->buf_end; p++) { 1667 1688 switch (*p) { ··· 1673 1694 if (capture_name) { 1674 1695 p += 3; 1675 1696 if (re_parse_group_name(name, sizeof(name), &p) == 0) { 1676 - if (!strcmp(name, capture_name)) 1677 - return capture_index; 1697 + if (!strcmp(name, capture_name)) { 1698 + if (emit_group_index) 1699 + dbuf_putc(&s->byte_code, capture_index); 1700 + n++; 1701 + } 1678 1702 } 1679 1703 } 1680 1704 capture_index++; ··· 1699 1723 } 1700 1724 } 1701 1725 done: 1702 - if (capture_name) 1703 - return -1; 1704 - else 1726 + if (capture_name) { 1727 + return n; 1728 + } else { 1705 1729 return capture_index; 1730 + } 1706 1731 } 1707 1732 1708 1733 static int re_count_captures(REParseState *s) 1709 1734 { 1710 1735 if (s->total_capture_count < 0) { 1711 1736 s->total_capture_count = re_parse_captures(s, &s->has_named_captures, 1712 - NULL); 1737 + NULL, FALSE); 1713 1738 } 1714 1739 return s->total_capture_count; 1715 1740 } ··· 1721 1746 return s->has_named_captures; 1722 1747 } 1723 1748 1724 - static int find_group_name(REParseState *s, const char *name) 1749 + static int find_group_name(REParseState *s, const char *name, BOOL emit_group_index) 1725 1750 { 1726 1751 const char *p, *buf_end; 1727 1752 size_t len, name_len; 1728 - int capture_index; 1753 + int capture_index, n; 1729 1754 1730 1755 p = (char *)s->group_names.buf; 1731 - if (!p) return -1; 1756 + if (!p) 1757 + return 0; 1732 1758 buf_end = (char *)s->group_names.buf + s->group_names.size; 1733 1759 name_len = strlen(name); 1734 1760 capture_index = 1; 1761 + n = 0; 1735 1762 while (p < buf_end) { 1736 1763 len = strlen(p); 1737 - if (len == name_len && memcmp(name, p, name_len) == 0) 1738 - return capture_index; 1739 - p += len + 1; 1764 + if (len == name_len && memcmp(name, p, name_len) == 0) { 1765 + if (emit_group_index) 1766 + dbuf_putc(&s->byte_code, capture_index); 1767 + n++; 1768 + } 1769 + p += len + LRE_GROUP_NAME_TRAILER_LEN; 1740 1770 capture_index++; 1741 1771 } 1742 - return -1; 1772 + return n; 1773 + } 1774 + 1775 + static BOOL is_duplicate_group_name(REParseState *s, const char *name, int scope) 1776 + { 1777 + const char *p, *buf_end; 1778 + size_t len, name_len; 1779 + int scope1; 1780 + 1781 + p = (char *)s->group_names.buf; 1782 + if (!p) 1783 + return 0; 1784 + buf_end = (char *)s->group_names.buf + s->group_names.size; 1785 + name_len = strlen(name); 1786 + while (p < buf_end) { 1787 + len = strlen(p); 1788 + if (len == name_len && memcmp(name, p, name_len) == 0) { 1789 + scope1 = (uint8_t)p[len + 1]; 1790 + if (scope == scope1) 1791 + return TRUE; 1792 + } 1793 + p += len + LRE_GROUP_NAME_TRAILER_LEN; 1794 + } 1795 + return FALSE; 1743 1796 } 1744 1797 1745 1798 static int re_parse_disjunction(REParseState *s, BOOL is_backward_dir); ··· 1783 1836 { 1784 1837 const uint8_t *p; 1785 1838 int c, last_atom_start, quant_min, quant_max, last_capture_count; 1786 - BOOL greedy, add_zero_advance_check, is_neg, is_backward_lookahead; 1839 + BOOL greedy, is_neg, is_backward_lookahead; 1787 1840 REStringList cr_s, *cr = &cr_s; 1788 1841 1789 1842 last_atom_start = -1; ··· 1922 1975 &p)) { 1923 1976 return re_parse_error(s, "invalid group name"); 1924 1977 } 1925 - if (find_group_name(s, s->u.tmp_buf) > 0) { 1978 + /* poor's man method to test duplicate group 1979 + names. */ 1980 + /* XXX: this method does not catch all the errors*/ 1981 + if (is_duplicate_group_name(s, s->u.tmp_buf, s->group_name_scope)) { 1926 1982 return re_parse_error(s, "duplicate group name"); 1927 1983 } 1928 1984 /* group name with a trailing zero */ 1929 1985 dbuf_put(&s->group_names, (uint8_t *)s->u.tmp_buf, 1930 1986 strlen(s->u.tmp_buf) + 1); 1987 + dbuf_putc(&s->group_names, s->group_name_scope); 1931 1988 s->has_named_captures = 1; 1932 1989 goto parse_capture; 1933 1990 } else { ··· 1938 1995 p++; 1939 1996 /* capture without group name */ 1940 1997 dbuf_putc(&s->group_names, 0); 1998 + dbuf_putc(&s->group_names, 0); 1941 1999 parse_capture: 1942 2000 if (s->capture_count >= CAPTURE_COUNT_MAX) 1943 2001 return re_parse_error(s, "too many captures"); ··· 1973 2031 case 'k': 1974 2032 { 1975 2033 const uint8_t *p1; 1976 - int dummy_res; 1977 - 2034 + int dummy_res, n; 2035 + BOOL is_forward; 2036 + 1978 2037 p1 = p; 1979 2038 if (p1[2] != '<') { 1980 2039 /* annex B: we tolerate invalid group names in non ··· 1993 2052 else 1994 2053 goto parse_class_atom; 1995 2054 } 1996 - c = find_group_name(s, s->u.tmp_buf); 1997 - if (c < 0) { 2055 + is_forward = FALSE; 2056 + n = find_group_name(s, s->u.tmp_buf, FALSE); 2057 + if (n == 0) { 1998 2058 /* no capture name parsed before, try to look 1999 2059 after (inefficient, but hopefully not common */ 2000 - c = re_parse_captures(s, &dummy_res, s->u.tmp_buf); 2001 - if (c < 0) { 2060 + n = re_parse_captures(s, &dummy_res, s->u.tmp_buf, FALSE); 2061 + if (n == 0) { 2002 2062 if (s->is_unicode || re_has_named_captures(s)) 2003 2063 return re_parse_error(s, "group name not defined"); 2004 2064 else 2005 2065 goto parse_class_atom; 2006 2066 } 2067 + is_forward = TRUE; 2068 + } 2069 + last_atom_start = s->byte_code.size; 2070 + last_capture_count = s->capture_count; 2071 + 2072 + /* emit back references to all the captures indexes matching the group name */ 2073 + re_emit_op_u8(s, REOP_back_reference + 2 * is_backward_dir + s->ignore_case, n); 2074 + if (is_forward) { 2075 + re_parse_captures(s, &dummy_res, s->u.tmp_buf, TRUE); 2076 + } else { 2077 + find_group_name(s, s->u.tmp_buf, TRUE); 2007 2078 } 2008 2079 p = p1; 2009 2080 } 2010 - goto emit_back_reference; 2081 + break; 2011 2082 case '0': 2012 2083 p += 2; 2013 2084 c = 0; ··· 2053 2124 } 2054 2125 return re_parse_error(s, "back reference out of range in regular expression"); 2055 2126 } 2056 - emit_back_reference: 2057 2127 last_atom_start = s->byte_code.size; 2058 2128 last_capture_count = s->capture_count; 2059 2129 2060 - re_emit_op_u8(s, REOP_back_reference + 2 * is_backward_dir + s->ignore_case, c); 2130 + re_emit_op_u8(s, REOP_back_reference + 2 * is_backward_dir + s->ignore_case, 1); 2131 + dbuf_putc(&s->byte_code, c); 2061 2132 } 2062 2133 break; 2063 2134 default: ··· 2166 2237 if (last_atom_start < 0) { 2167 2238 return re_parse_error(s, "nothing to repeat"); 2168 2239 } 2169 - /* the spec tells that if there is no advance when 2170 - running the atom after the first quant_min times, 2171 - then there is no match. We remove this test when we 2172 - are sure the atom always advances the position. */ 2173 - add_zero_advance_check = re_need_check_advance(s->byte_code.buf + last_atom_start, 2174 - s->byte_code.size - last_atom_start); 2175 - 2176 2240 { 2241 + BOOL need_capture_init, add_zero_advance_check; 2177 2242 int len, pos; 2243 + 2244 + /* the spec tells that if there is no advance when 2245 + running the atom after the first quant_min times, 2246 + then there is no match. We remove this test when we 2247 + are sure the atom always advances the position. */ 2248 + add_zero_advance_check = 2249 + re_need_check_adv_and_capture_init(&need_capture_init, 2250 + s->byte_code.buf + last_atom_start, 2251 + s->byte_code.size - last_atom_start); 2252 + 2253 + /* general case: need to reset the capture at each 2254 + iteration. We don't do it if there are no captures 2255 + in the atom or if we are sure all captures are 2256 + initialized in the atom. If quant_min = 0, we still 2257 + need to reset once the captures in case the atom 2258 + does not match. */ 2259 + if (need_capture_init && last_capture_count != s->capture_count) { 2260 + if (dbuf_insert(&s->byte_code, last_atom_start, 3)) 2261 + goto out_of_memory; 2262 + int pos = last_atom_start; 2263 + s->byte_code.buf[pos++] = REOP_save_reset; 2264 + s->byte_code.buf[pos++] = last_capture_count; 2265 + s->byte_code.buf[pos++] = s->capture_count - 1; 2266 + } 2267 + 2178 2268 len = s->byte_code.size - last_atom_start; 2179 2269 if (quant_min == 0) { 2180 2270 /* need to reset the capture in case the atom is 2181 2271 not executed */ 2182 - if (last_capture_count != s->capture_count) { 2272 + if (!need_capture_init && last_capture_count != s->capture_count) { 2183 2273 if (dbuf_insert(&s->byte_code, last_atom_start, 3)) 2184 2274 goto out_of_memory; 2185 2275 s->byte_code.buf[last_atom_start++] = REOP_save_reset; ··· 2320 2410 2321 2411 pos = re_emit_op_u32(s, REOP_goto, 0); 2322 2412 2413 + s->group_name_scope++; 2414 + 2323 2415 if (re_parse_alternative(s, is_backward_dir)) 2324 2416 return -1; 2325 2417 ··· 2382 2474 val = get_u16(bc_buf + pos + 1); 2383 2475 len += val * 8; 2384 2476 break; 2477 + case REOP_back_reference: 2478 + case REOP_back_reference_i: 2479 + case REOP_backward_back_reference: 2480 + case REOP_backward_back_reference_i: 2481 + val = bc_buf[pos + 1]; 2482 + len += val; 2483 + break; 2385 2484 } 2386 2485 pos += len; 2387 2486 } ··· 2481 2580 s->byte_code.size - RE_HEADER_LEN); 2482 2581 2483 2582 /* add the named groups if needed */ 2484 - if (s->group_names.size > (s->capture_count - 1)) { 2583 + if (s->group_names.size > (s->capture_count - 1) * LRE_GROUP_NAME_TRAILER_LEN) { 2485 2584 dbuf_put(&s->byte_code, s->group_names.buf, s->group_names.size); 2486 2585 put_u16(s->byte_code.buf + RE_HEADER_FLAGS, 2487 2586 lre_get_flags(s->byte_code.buf) | LRE_FLAG_NAMED_GROUPS); ··· 3057 3156 case REOP_backward_back_reference_i: 3058 3157 { 3059 3158 const uint8_t *cptr1, *cptr1_end, *cptr1_start; 3159 + const uint8_t *pc1; 3060 3160 uint32_t c1, c2; 3161 + int i, n; 3061 3162 3062 - val = *pc++; 3063 - if (val >= s->capture_count) 3064 - goto no_match; 3065 - cptr1_start = capture[2 * val]; 3066 - cptr1_end = capture[2 * val + 1]; 3067 - if (!cptr1_start || !cptr1_end) 3068 - break; 3069 - if (opcode == REOP_back_reference || 3070 - opcode == REOP_back_reference_i) { 3071 - cptr1 = cptr1_start; 3072 - while (cptr1 < cptr1_end) { 3073 - if (cptr >= cbuf_end) 3074 - goto no_match; 3075 - GET_CHAR(c1, cptr1, cptr1_end, cbuf_type); 3076 - GET_CHAR(c2, cptr, cbuf_end, cbuf_type); 3077 - if (opcode == REOP_back_reference_i) { 3078 - c1 = lre_canonicalize(c1, s->is_unicode); 3079 - c2 = lre_canonicalize(c2, s->is_unicode); 3080 - } 3081 - if (c1 != c2) 3082 - goto no_match; 3083 - } 3084 - } else { 3085 - cptr1 = cptr1_end; 3086 - while (cptr1 > cptr1_start) { 3087 - if (cptr == s->cbuf) 3088 - goto no_match; 3089 - GET_PREV_CHAR(c1, cptr1, cptr1_start, cbuf_type); 3090 - GET_PREV_CHAR(c2, cptr, s->cbuf, cbuf_type); 3091 - if (opcode == REOP_backward_back_reference_i) { 3092 - c1 = lre_canonicalize(c1, s->is_unicode); 3093 - c2 = lre_canonicalize(c2, s->is_unicode); 3163 + n = *pc++; 3164 + pc1 = pc; 3165 + pc += n; 3166 + 3167 + for(i = 0; i < n; i++) { 3168 + val = pc1[i]; 3169 + if (val >= s->capture_count) 3170 + goto no_match; 3171 + cptr1_start = capture[2 * val]; 3172 + cptr1_end = capture[2 * val + 1]; 3173 + /* test the first not empty capture */ 3174 + if (cptr1_start && cptr1_end) { 3175 + if (opcode == REOP_back_reference || 3176 + opcode == REOP_back_reference_i) { 3177 + cptr1 = cptr1_start; 3178 + while (cptr1 < cptr1_end) { 3179 + if (cptr >= cbuf_end) 3180 + goto no_match; 3181 + GET_CHAR(c1, cptr1, cptr1_end, cbuf_type); 3182 + GET_CHAR(c2, cptr, cbuf_end, cbuf_type); 3183 + if (opcode == REOP_back_reference_i) { 3184 + c1 = lre_canonicalize(c1, s->is_unicode); 3185 + c2 = lre_canonicalize(c2, s->is_unicode); 3186 + } 3187 + if (c1 != c2) 3188 + goto no_match; 3189 + } 3190 + } else { 3191 + cptr1 = cptr1_end; 3192 + while (cptr1 > cptr1_start) { 3193 + if (cptr == s->cbuf) 3194 + goto no_match; 3195 + GET_PREV_CHAR(c1, cptr1, cptr1_start, cbuf_type); 3196 + GET_PREV_CHAR(c2, cptr, s->cbuf, cbuf_type); 3197 + if (opcode == REOP_backward_back_reference_i) { 3198 + c1 = lre_canonicalize(c1, s->is_unicode); 3199 + c2 = lre_canonicalize(c2, s->is_unicode); 3200 + } 3201 + if (c1 != c2) 3202 + goto no_match; 3203 + } 3094 3204 } 3095 - if (c1 != c2) 3096 - goto no_match; 3205 + break; 3097 3206 } 3098 3207 } 3099 3208 }
+3
vendor/git/quickjs-c/libregexp.h
··· 40 40 #define LRE_RET_MEMORY_ERROR (-1) 41 41 #define LRE_RET_TIMEOUT (-2) 42 42 43 + /* trailer length after the group name including the trailing '\0' */ 44 + #define LRE_GROUP_NAME_TRAILER_LEN 2 45 + 43 46 uint8_t *lre_compile(int *plen, char *error_msg, int error_msg_size, 44 47 const char *buf, size_t buf_len, int re_flags, 45 48 void *opaque);
+34 -17
vendor/git/quickjs-c/quickjs.c
··· 47405 47405 int64_t last_index; 47406 47406 const char *group_name_ptr; 47407 47407 JSObject *p_obj; 47408 - 47408 + JSAtom group_name; 47409 + 47409 47410 if (!re) 47410 47411 return JS_EXCEPTION; 47411 47412 ··· 47419 47420 indices = JS_UNDEFINED; 47420 47421 indices_groups = JS_UNDEFINED; 47421 47422 capture = NULL; 47422 - 47423 + group_name = JS_ATOM_NULL; 47424 + 47423 47425 if (js_regexp_get_lastIndex(ctx, &last_index, this_val)) 47424 47426 goto fail; 47425 47427 ··· 47501 47503 goto fail; 47502 47504 47503 47505 for(i = 0; i < capture_count; i++) { 47504 - const char *name = NULL; 47505 47506 uint8_t **match = &capture[2 * i]; 47506 47507 int start = -1; 47507 47508 int end = -1; 47508 47509 JSValue val; 47509 47510 47510 47511 if (group_name_ptr && i > 0) { 47511 - if (*group_name_ptr) name = group_name_ptr; 47512 - group_name_ptr += strlen(group_name_ptr) + 1; 47512 + if (*group_name_ptr) { 47513 + /* XXX: slow, should create a shape when the regexp is 47514 + compiled */ 47515 + group_name = JS_NewAtom(ctx, group_name_ptr); 47516 + if (group_name == JS_ATOM_NULL) 47517 + goto fail; 47518 + } 47519 + group_name_ptr += strlen(group_name_ptr) + LRE_GROUP_NAME_TRAILER_LEN; 47513 47520 } 47514 47521 47515 47522 if (match[0] && match[1]) { ··· 47536 47543 goto fail; 47537 47544 } 47538 47545 } 47539 - if (name && !JS_IsUndefined(indices_groups)) { 47540 - val = JS_DupValue(ctx, val); 47541 - if (JS_DefinePropertyValueStr(ctx, indices_groups, 47542 - name, val, prop_flags) < 0) { 47543 - JS_FreeValue(ctx, val); 47544 - goto fail; 47546 + if (group_name != JS_ATOM_NULL) { 47547 + /* JS_HasProperty() cannot fail here */ 47548 + if (!JS_IsUndefined(val) || 47549 + !JS_HasProperty(ctx, indices_groups, group_name)) { 47550 + if (JS_DefinePropertyValue(ctx, indices_groups, 47551 + group_name, JS_DupValue(ctx, val), prop_flags) < 0) { 47552 + JS_FreeValue(ctx, val); 47553 + goto fail; 47554 + } 47545 47555 } 47546 47556 } 47547 47557 if (JS_DefinePropertyValueUint32(ctx, indices, i, val, ··· 47557 47567 goto fail; 47558 47568 } 47559 47569 47560 - if (name) { 47561 - if (JS_DefinePropertyValueStr(ctx, groups, name, 47562 - JS_DupValue(ctx, val), 47563 - prop_flags) < 0) { 47564 - JS_FreeValue(ctx, val); 47565 - goto fail; 47570 + if (group_name != JS_ATOM_NULL) { 47571 + /* JS_HasProperty() cannot fail here */ 47572 + if (!JS_IsUndefined(val) || 47573 + !JS_HasProperty(ctx, groups, group_name)) { 47574 + if (JS_DefinePropertyValue(ctx, groups, group_name, 47575 + JS_DupValue(ctx, val), 47576 + prop_flags) < 0) { 47577 + JS_FreeValue(ctx, val); 47578 + goto fail; 47579 + } 47566 47580 } 47581 + JS_FreeAtom(ctx, group_name); 47582 + group_name = JS_ATOM_NULL; 47567 47583 } 47568 47584 p_obj->u.array.u.values[p_obj->u.array.count++] = val; 47569 47585 } ··· 47584 47600 ret = obj; 47585 47601 obj = JS_UNDEFINED; 47586 47602 fail: 47603 + JS_FreeAtom(ctx, group_name); 47587 47604 JS_FreeValue(ctx, indices_groups); 47588 47605 JS_FreeValue(ctx, indices); 47589 47606 JS_FreeValue(ctx, str_val);
+1 -1
vendor/git/quickjs-c/test262.conf
··· 176 176 Reflect.set 177 177 Reflect.setPrototypeOf 178 178 regexp-dotall 179 - regexp-duplicate-named-groups=skip 179 + regexp-duplicate-named-groups 180 180 regexp-lookbehind 181 181 regexp-match-indices 182 182 regexp-modifiers
-6
vendor/git/quickjs-c/test262_errors.txt
··· 31 31 test262/test/staging/sm/Function/implicit-this-in-parameter-expression.js:12: Test262Error: Expected SameValue(«[object Object]», «undefined») to be true 32 32 test262/test/staging/sm/Function/invalid-parameter-list.js:13: Test262Error: Expected a SyntaxError to be thrown but no exception was thrown at all 33 33 test262/test/staging/sm/Function/invalid-parameter-list.js:13: strict mode: Test262Error: Expected a SyntaxError to be thrown but no exception was thrown at all 34 - test262/test/staging/sm/RegExp/regress-613820-1.js:12: Test262Error: Actual [aaa, aa, a] and expected [aa, a, a] should have the same contents. 35 - test262/test/staging/sm/RegExp/regress-613820-1.js:12: strict mode: Test262Error: Actual [aaa, aa, a] and expected [aa, a, a] should have the same contents. 36 - test262/test/staging/sm/RegExp/regress-613820-2.js:12: Test262Error: Actual [foobar, f, o, o, b, a, r] and expected [foobar, undefined, undefined, undefined, b, a, r] should have the same contents. 37 - test262/test/staging/sm/RegExp/regress-613820-2.js:12: strict mode: Test262Error: Actual [foobar, f, o, o, b, a, r] and expected [foobar, undefined, undefined, undefined, b, a, r] should have the same contents. 38 - test262/test/staging/sm/RegExp/regress-613820-3.js:12: Test262Error: Actual [aab, a, undefined, ab] and expected [aa, undefined, a, undefined] should have the same contents. 39 - test262/test/staging/sm/RegExp/regress-613820-3.js:12: strict mode: Test262Error: Actual [aab, a, undefined, ab] and expected [aa, undefined, a, undefined] should have the same contents. 40 34 test262/test/staging/sm/String/string-upper-lower-mapping.js:16: Test262Error: Expected SameValue(«"꟏"», «"꟎"») to be true 41 35 test262/test/staging/sm/String/string-upper-lower-mapping.js:16: strict mode: Test262Error: Expected SameValue(«"꟏"», «"꟎"») to be true 42 36 test262/test/staging/sm/TypedArray/constructor-buffer-sequence.js:29: Test262Error: Expected a ExpectedError but got a Error