LibRegex: Respect V8 astral literal lastIndex behavior

Preserve V8's behavior for bare single-astral literals when a unicode
global search starts in the middle of a surrogate pair. We were
snapping that lastIndex back to the pair start unconditionally,
which let /😀/gu and /\u{1F600}/gu match where V8 returns null.

Expose that literal shape from LibRegex to LibJS and add runtime
coverage for the bare literal case alongside a grouped control.
This commit is contained in:
Andreas Kling
2026-03-25 22:51:10 +01:00
committed by Ali Mohammad Pur
parent 29c2fb9574
commit f627b7dcbb
Notes: github-actions[bot] 2026-03-27 16:33:38 +00:00
8 changed files with 52 additions and 1 deletions

View File

@@ -90,6 +90,11 @@ unsigned int ECMAScriptRegex::total_groups() const
return m_impl->rust_regex.total_groups();
}
bool ECMAScriptRegex::is_single_non_bmp_literal() const
{
return m_impl->rust_regex.is_single_non_bmp_literal();
}
Vector<ECMAScriptNamedCaptureGroup> const& ECMAScriptRegex::named_groups() const
{
return m_impl->named_groups;