test262: RegExp conformance fixes (wave 11) - #67
Merged
Conversation
Wire the well-known-symbol methods on a RegExp receiver — re[Symbol.match](s),
re[Symbol.replace](s, r), re[Symbol.search](s), re[Symbol.split](s, lim) — through
the frontend. A computed-key call whose key is one of these symbols was previously
lowered as an ordinary property read (undefined), so every such call crashed with
{badfun,undefined}.
Each method is the receiver-swapped twin of the matching String.prototype method
(String.prototype.match(re) is itself defined as invoking re[Symbol.match](s)), so
they route to the identical runtime op with the string as receiver and the regex as
the pattern argument, reusing the existing global/sticky lastIndex handling.
Covers §22.2.6.8/.11/.12/.14.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Routes the RegExp well-known-symbol methods on a RegExp receiver through the JS frontend:
re[Symbol.match](s),re[Symbol.replace](s, r),re[Symbol.search](s),re[Symbol.split](s, lim).Previously a computed-key call whose key was one of these symbols was lowered as an ordinary property read (undefined), so every such call crashed with
{badfun,undefined}. Each method is the receiver-swapped twin of the matchingString.prototypemethod (indeedString.prototype.match(re)is defined as invokingre[Symbol.match](s)), so they route to the same runtime op with the string as receiver and the regex as the pattern argument, reusing the existing global/sticky lastIndex handling.Spec: ECMAScript §22.2.6.8 (@@match), §22.2.6.11 (@@replace), §22.2.6.12 (@@search), §22.2.6.14 (@@split).
test262
test/built-ins/RegExp/prototype: pass 78 → 115 (runtime_error 96 → 41). New spec-driven tests appended to js_compiler_test.gleam. No FFI or shared-helper changes.