-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#627 broke RegExpBuiltinExec? #777
Comments
In PR #627, I had incorrectly removed a “useless” read access to the The proper fix is probably to revert that part of the PR, i.e.: 1. Assert: _R_ is an initialized RegExp instance.
1. Assert: Type(_S_) is String.
1. Let _length_ be the number of code units in _S_.
+ 1. Let _lastIndex_ be ? ToLength(? Get(_R_, `"lastIndex"`)).
1. Let _flags_ be _R_.[[OriginalFlags]].
1. If _flags_ contains `"g"`, let _global_ be *true*, else let _global_ be *false*.
1. If _flags_ contains `"y"`, let _sticky_ be *true*, else let _sticky_ be *false*.
1. If _global_ is *false* and _sticky_ is *false*, let _lastIndex_ be 0.
- 1. Else, let _lastIndex_ be ? ToLength(? Get(_R_, `"lastIndex"`)).
1. Let _matcher_ be _R_.[[RegExpMatcher]].
1. If _flags_ contains `"u"`, let _fullUnicode_ be *true*, else let _fullUnicode_ be *false*.
1. Let _matchSucceeded_ be *false*. |
I thought that part was required for #627, but if that's not the case, your fix is certainly the way to go! |
It was not. The motivation was Issue #625, and the required part is avoiding unnecessary writing to the In ”reasonable” situations, uselessly reading the |
cc @schuay |
From https://bugzilla.mozilla.org/show_bug.cgi?id=1317397#c1:
The obvious band-aid fix is:
But I'm not sure that's the correct way to fix this bug.
(If anyone wonders why global and sticky are also reset, that's to avoid regressing #494, #489.)
The text was updated successfully, but these errors were encountered: