mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
LibJS: Update spec numbers/steps for RegExp unicode sets flag proposal
This proposal has been merged into the main ECMA-262 spec. See:
26b2369
This commit is contained in:
parent
9407e05a3c
commit
32502fceed
2 changed files with 52 additions and 67 deletions
|
@ -167,8 +167,6 @@ ThrowCompletionOr<void> RegExpObject::initialize(Realm& realm)
|
|||
// 22.2.3.3 RegExpInitialize ( obj, pattern, flags ), https://tc39.es/ecma262/#sec-regexpinitialize
|
||||
ThrowCompletionOr<NonnullGCPtr<RegExpObject>> RegExpObject::regexp_initialize(VM& vm, Value pattern_value, Value flags_value)
|
||||
{
|
||||
// NOTE: This also contains changes adapted from https://arai-a.github.io/ecma262-compare/?pr=2418, which doesn't match the upstream spec anymore.
|
||||
|
||||
// 1. If pattern is undefined, let P be the empty String.
|
||||
// 2. Else, let P be ? ToString(pattern).
|
||||
auto pattern = pattern_value.is_undefined()
|
||||
|
@ -181,7 +179,7 @@ ThrowCompletionOr<NonnullGCPtr<RegExpObject>> RegExpObject::regexp_initialize(VM
|
|||
? DeprecatedString::empty()
|
||||
: TRY(flags_value.to_deprecated_string(vm));
|
||||
|
||||
// 5. If F contains any code unit other than "d", "g", "i", "m", "s", "u", or "y" or if it contains the same code unit more than once, throw a SyntaxError exception.
|
||||
// 5. If F contains any code unit other than "d", "g", "i", "m", "s", "u", "v", or "y", or if F contains any code unit more than once, throw a SyntaxError exception.
|
||||
// 6. If F contains "i", let i be true; else let i be false.
|
||||
// 7. If F contains "m", let m be true; else let m be false.
|
||||
// 8. If F contains "s", let s be true; else let s be false.
|
||||
|
@ -197,7 +195,7 @@ ThrowCompletionOr<NonnullGCPtr<RegExpObject>> RegExpObject::regexp_initialize(VM
|
|||
bool unicode = parsed_flags.has_flag_set(regex::ECMAScriptFlags::Unicode);
|
||||
bool unicode_sets = parsed_flags.has_flag_set(regex::ECMAScriptFlags::UnicodeSets);
|
||||
|
||||
// 11. If u is true, then
|
||||
// 11. If u is true or v is true, then
|
||||
// a. Let patternText be StringToCodePoints(P).
|
||||
// 12. Else,
|
||||
// a. Let patternText be the result of interpreting each of P's 16-bit elements as a Unicode BMP code point. UTF-16 decoding is not applied to the elements.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue