File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -2418,6 +2418,7 @@ bool ECMA262Parser::parse_nested_class(Vector<regex::CompareTypeAndValuePair>& c
24182418 if (match (TokenType::LeftBracket)) {
24192419 consume ();
24202420
2421+ auto initial_compares_size = compares.size ();
24212422 compares.append (CompareTypeAndValuePair { CharacterCompareType::Or, 0 });
24222423
24232424 if (match (TokenType::Circumflex)) {
@@ -2429,12 +2430,13 @@ bool ECMA262Parser::parse_nested_class(Vector<regex::CompareTypeAndValuePair>& c
24292430 // ClassContents :: [empty]
24302431 if (match (TokenType::RightBracket)) {
24312432 consume ();
2433+ auto added_compares = compares.size () - initial_compares_size;
24322434 // Should only have at most an 'Inverse' (after an 'Or')
24332435 if (m_parser_state.regex_options .has_flag_set (regex::AllFlags::UnicodeSets)) {
24342436 // In unicode sets mode, we can have an additional 'And'/'Or' before the 'Inverse'.
2435- VERIFY (compares. size () <= 3 );
2437+ VERIFY (added_compares <= 3 );
24362438 } else {
2437- VERIFY (compares. size () <= 2 );
2439+ VERIFY (added_compares <= 2 );
24382440 }
24392441 compares.append (CompareTypeAndValuePair { CharacterCompareType::EndAndOr, 0 });
24402442 return true ;
Original file line number Diff line number Diff line change @@ -891,6 +891,7 @@ TEST_CASE(ECMA262_unicode_sets_match)
891891 { " [\\ w&&\\ d]" sv, " a" sv, false },
892892 { " [\\ w&&\\ d]" sv, " 4" sv, true },
893893 { " ([^\\ :]+?)" sv, " a" sv, true },
894+ { " [[a][]]" sv, " a" sv, true }, // ladybird#6647
894895 };
895896
896897 for (auto & test : tests) {
You can’t perform that action at this time.
0 commit comments