Skip to content
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

Implement String.prototype.replaceAll #1469

Merged
merged 3 commits into from
Aug 17, 2021

Conversation

raskad
Copy link
Member

@raskad raskad commented Aug 15, 2021

This Pull Request relates to #13.

It changes the following:

  • Implement String.prototype.replaceAll
  • Implement StringIndexOf on JsString
  • Fix some utf16 related bugs in GetSubstitution

Not all tests in the built-ins/String/prototype/replaceAll suite pass. I checked all failing tests and each one can be attributed to some other bug/missing feature. I will open issues for those who have none.

@raskad
Copy link
Member Author

raskad commented Aug 15, 2021

Test262 conformance changes:

Test result master count PR count difference
Total 78,897 78,897 0
Passed 29,633 29,689 +56
Ignored 15,612 15,612 0
Failed 33,652 33,596 -56
Panics 2 2 0
Conformance 37.56% 37.63% +0.07%
Fixed tests:
test/built-ins/String/prototype/replaceAll/replaceAll.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceAll.js (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-tostring-regexp.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-tostring-regexp.js (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-call-abrupt.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-call-abrupt.js (previously Failed)
test/built-ins/String/prototype/replaceAll/length.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/length.js (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-tostring-abrupt.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-tostring-abrupt.js (previously Failed)
test/built-ins/String/prototype/replaceAll/this-tostring-abrupt.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/this-tostring-abrupt.js (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-fn-skip-toString.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-fn-skip-toString.js (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-tostring-abrupt.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-tostring-abrupt.js (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-call-skip-no-match.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-call-skip-no-match.js (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-empty-string-this-empty-string.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-empty-string-this-empty-string.js (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-flags-no-g-throws.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-flags-no-g-throws.js (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024.js (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-replacer-before-tostring.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-replacer-before-tostring.js (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-empty-string.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-empty-string.js (previously Failed)
test/built-ins/String/prototype/replaceAll/this-is-null-throws.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/this-is-null-throws.js (previously Failed)
test/built-ins/String/prototype/replaceAll/this-is-undefined-throws.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/this-is-undefined-throws.js (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x0026.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x0026.js (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-replacer-is-null.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-replacer-is-null.js (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x003C.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x003C.js (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024N.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024N.js (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-value-replaces-string.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-value-replaces-string.js (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-replacer-call.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/searchValue-replacer-call.js (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x0060.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x0060.js (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024NN.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024NN.js (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x0027.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x0027.js (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-call-tostring-abrupt.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/replaceValue-call-tostring-abrupt.js (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x0024.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/getSubstitution-0x0024-0x0024.js (previously Failed)
test/built-ins/String/prototype/replaceAll/name.js [strict mode] (previously Failed)
test/built-ins/String/prototype/replaceAll/name.js (previously Failed)

@HalidOdat HalidOdat added builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request labels Aug 15, 2021
@HalidOdat HalidOdat added this to the v0.13.0 milestone Aug 15, 2021
Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the small change, it looks good to me :)

boa/src/builtins/string/mod.rs Outdated Show resolved Hide resolved
@HalidOdat
Copy link
Member

Just needs a rebase :)

@raskad
Copy link
Member Author

raskad commented Aug 15, 2021

Just needs a rebase :)

Done + fixed the fmt error in master ;)

@HalidOdat HalidOdat changed the title Implement String.prototype.replaceAll Implement String.prototype.replaceAll Aug 17, 2021
@HalidOdat HalidOdat merged commit 17c412f into boa-dev:master Aug 17, 2021
@raskad raskad deleted the string-replace-all branch September 10, 2021 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants