editorial: Get/Set 'lastIndex' on RegExp object cannot trigger user-code #3636
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purely an editorial change, this implies no change in the implementation: The
Get
andSet
calls on "lastIndex" property of a builtin RegExp object cannot trigger user-code, as the property is installed as an unconfigurable own data property of the object with a set value: the property cannot be turned into an accessor property, and the value cannot be unset to make the Get/Set operations enter the prototype chain.The
Get
call on"lastIndex"
is thus fully infallible: it will always find a valid property value and can never throw any errors.The
Set
call on"lastIndex"
can still throw errors, as the property can be made unwritable in which case trying to change its value will throw an error.This appears most importantly in the
RegExpBuiltinExec
function but also inRegExpInitialize
.