mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-21 07:29:53 +00:00
LibJS+LibWeb: Port interned bytecode strings to UTF-16
This was almost a no-op, except we intern JS exception messages. So the bulk of this patch is porting exception messages to UTF-16.
This commit is contained in:
parent
cf61171864
commit
70db474cf0
Notes:
github-actions[bot]
2025-08-14 08:28:16 +00:00
Author: https://github.com/trflynn89
Commit: 70db474cf0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5845
Reviewed-by: https://github.com/gmta ✅
162 changed files with 1405 additions and 1422 deletions
|
@ -30,42 +30,42 @@ Result<regex::RegexOptions<ECMAScriptFlags>, String> regex_flags_from_string(Utf
|
|||
switch (ch) {
|
||||
case 'd':
|
||||
if (d)
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.message(), ch));
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.format(), ch));
|
||||
d = true;
|
||||
break;
|
||||
case 'g':
|
||||
if (g)
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.message(), ch));
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.format(), ch));
|
||||
g = true;
|
||||
options |= regex::ECMAScriptFlags::Global;
|
||||
break;
|
||||
case 'i':
|
||||
if (i)
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.message(), ch));
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.format(), ch));
|
||||
i = true;
|
||||
options |= regex::ECMAScriptFlags::Insensitive;
|
||||
break;
|
||||
case 'm':
|
||||
if (m)
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.message(), ch));
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.format(), ch));
|
||||
m = true;
|
||||
options |= regex::ECMAScriptFlags::Multiline;
|
||||
break;
|
||||
case 's':
|
||||
if (s)
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.message(), ch));
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.format(), ch));
|
||||
s = true;
|
||||
options |= regex::ECMAScriptFlags::SingleLine;
|
||||
break;
|
||||
case 'u':
|
||||
if (u)
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.message(), ch));
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.format(), ch));
|
||||
u = true;
|
||||
options |= regex::ECMAScriptFlags::Unicode;
|
||||
break;
|
||||
case 'y':
|
||||
if (y)
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.message(), ch));
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.format(), ch));
|
||||
y = true;
|
||||
// Now for the more interesting flag, 'sticky' actually unsets 'global', part of which is the default.
|
||||
options.reset_flag(regex::ECMAScriptFlags::Global);
|
||||
|
@ -77,12 +77,12 @@ Result<regex::RegexOptions<ECMAScriptFlags>, String> regex_flags_from_string(Utf
|
|||
break;
|
||||
case 'v':
|
||||
if (v)
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.message(), ch));
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectRepeatedFlag.format(), ch));
|
||||
v = true;
|
||||
options |= regex::ECMAScriptFlags::UnicodeSets;
|
||||
break;
|
||||
default:
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectBadFlag.message(), ch));
|
||||
return MUST(String::formatted(ErrorType::RegExpObjectBadFlag.format(), ch));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ Result<regex::RegexOptions<ECMAScriptFlags>, String> regex_flags_from_string(Utf
|
|||
ErrorOr<String, ParseRegexPatternError> parse_regex_pattern(Utf16View const& pattern, bool unicode, bool unicode_sets)
|
||||
{
|
||||
if (unicode && unicode_sets)
|
||||
return ParseRegexPatternError { MUST(String::formatted(ErrorType::RegExpObjectIncompatibleFlags.message(), 'u', 'v')) };
|
||||
return ParseRegexPatternError { MUST(String::formatted(ErrorType::RegExpObjectIncompatibleFlags.format(), 'u', 'v')) };
|
||||
|
||||
StringBuilder builder;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue