Skip to content

Commit 7f45c77

Browse files
committed
Normative: Always check regular expression flags by "flags"
1 parent 4ec3cd3 commit 7f45c77

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

spec.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36474,12 +36474,11 @@ <h1>RegExp.prototype [ @@match ] ( _string_ )</h1>
3647436474
1. Let _rx_ be the *this* value.
3647536475
1. If Type(_rx_) is not Object, throw a *TypeError* exception.
3647636476
1. Let _S_ be ? ToString(_string_).
36477-
1. Let _global_ be ToBoolean(? Get(_rx_, *"global"*)).
36478-
1. If _global_ is *false*, then
36477+
1. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
36478+
1. If _flags_ does not contain *"g"*, then
3647936479
1. Return ? RegExpExec(_rx_, _S_).
3648036480
1. Else,
36481-
1. Assert: _global_ is *true*.
36482-
1. Let _fullUnicode_ be ToBoolean(? Get(_rx_, *"unicode"*)).
36481+
1. If _flags_ contains *"u"*, let _fullUnicode_ be *true*. Otherwise, let _fullUnicode_ be *false*.
3648336482
1. Perform ? Set(_rx_, *"lastIndex"*, *+0*<sub>𝔽</sub>, *true*).
3648436483
1. Let _A_ be ! ArrayCreate(0).
3648536484
1. Let _n_ be 0.
@@ -36545,9 +36544,10 @@ <h1>RegExp.prototype [ @@replace ] ( _string_, _replaceValue_ )</h1>
3654536544
1. Let _functionalReplace_ be IsCallable(_replaceValue_).
3654636545
1. If _functionalReplace_ is *false*, then
3654736546
1. Set _replaceValue_ to ? ToString(_replaceValue_).
36548-
1. Let _global_ be ToBoolean(? Get(_rx_, *"global"*)).
36547+
1. Let _flags_ be ? ToString(? Get(_rx_, *"flags"*)).
36548+
1. If _flags_ contains *"g"*, let _global_ be *true*. Otherwise, let _global_ be *false*.
3654936549
1. If _global_ is *true*, then
36550-
1. Let _fullUnicode_ be ToBoolean(? Get(_rx_, *"unicode"*)).
36550+
1. If _flags_ contains *"u"*, let _fullUnicode_ be *true*. Otherwise, let _fullUnicode_ be *false*.
3655136551
1. Perform ? Set(_rx_, *"lastIndex"*, *+0*<sub>𝔽</sub>, *true*).
3655236552
1. Let _results_ be a new empty List.
3655336553
1. Let _done_ be *false*.

0 commit comments

Comments
 (0)