From f44c4b2cbdf269867fdbc301abae2f1548bca77b Mon Sep 17 00:00:00 2001 From: Mathias Bynens <mathias@qiwi.be> Date: Fri, 14 Apr 2023 19:40:11 +0200 Subject: [PATCH] Follow upstream change to always check regular expression flags by `flags` (#16) https://github.com/tc39/ecma262/pull/2791 --- spec.html | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/spec.html b/spec.html index 6bbabf8888..c0b5b8a57d 100644 --- a/spec.html +++ b/spec.html @@ -36887,13 +36887,11 @@ <h1>RegExp.prototype [ @@match ] ( _string_ )</h1> 1. Let _rx_ be the *this* value. 1. If Type(_rx_) is not Object, throw a *TypeError* exception. 1. Let _S_ be ? ToString(_string_). - 1. Let _global_ be ! ToBoolean(? Get(_rx_, *"global"*)). - 1. If _global_ is *false*, then + 1. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)). + 1. If _flags_ does not contain *"g"*, then 1. Return ? RegExpExec(_rx_, _S_). 1. Else, - 1. Assert: _global_ is *true*. - 1. Let _fullUnicode_ be ! ToBoolean(? Get(_rx_, *"unicodeSets"*)). - 1. If _fullUnicode_ is *false*, set _fullUnicode_ to ! ToBoolean(? Get(_rx_, *"unicode"*)). + 1. If _flags_ contains *"u"* or _flags_ contains *"v"*, let _fullUnicode_ be *true*. Otherwise, let _fullUnicode_ be *false*. 1. Perform ? Set(_rx_, *"lastIndex"*, *+0*<sub>𝔽</sub>, *true*). 1. Let _A_ be ! ArrayCreate(0). 1. Let _n_ be 0. @@ -36959,11 +36957,11 @@ <h1>RegExp.prototype [ @@replace ] ( _string_, _replaceValue_ )</h1> 1. Let _functionalReplace_ be IsCallable(_replaceValue_). 1. If _functionalReplace_ is *false*, then 1. Set _replaceValue_ to ? ToString(_replaceValue_). - 1. Let _global_ be ! ToBoolean(? Get(_rx_, *"global"*)). + 1. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)). + 1. If _flags_ contains *"g"*, let _global_ be *true*. Otherwise, let _global_ be *false*. 1. If _global_ is *true*, then - 1. Let _fullUnicode_ be ! ToBoolean(? Get(_rx_, *"unicodeSets"*)). - 1. If _fullUnicode_ is *false*, set _fullUnicode_ to ! ToBoolean(? Get(_rx_, *"unicode"*)). 1. Perform ? Set(_rx_, *"lastIndex"*, *+0*<sub>𝔽</sub>, *true*). + 1. If _flags_ contains *"u"* or _flags_ contains *"v"*, let _fullUnicode_ be *true*. Otherwise, let _fullUnicode_ be *false*. 1. Let _results_ be a new empty List. 1. Let _done_ be *false*. 1. Repeat, while _done_ is *false*,