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

improved ScriptRuntime.toPrimitive() (taken from #1611 done by @tonygermano) #1661

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

rbri
Copy link
Collaborator

@rbri rbri commented Sep 29, 2024

this is an excerpt from PR #1611 done by @tonygermano (commit 9664e77, e17cc25)

  • more standard compliant implementation of ScriptRuntime.toPrimitive();
    • have not used the Optional for more backward compatibility
    • have changed the code a bit to be more in sync with the spec (explicit if stmt's)
  • improved support for Symbol/BigInt in equals and compare

I did this to make it possible to merge this improvement soon - at least this is my hope. Will extract more smaller commits if this is merged.

@gbrail
Copy link
Collaborator

gbrail commented Oct 1, 2024

I'd like to keep the super-pedantic warnings from errorprone clean. (I haven't made them errors yet but I'm thinking about it.) Can you please check these?

/Users/gbrail/src/rhino/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java:3995: warning: [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them
if ((isSymbol(val1)) || (isSymbol(val2))) {
^
(see https://errorprone.info/bugpattern/UnnecessaryParentheses)
Did you mean 'if ( isSymbol(val1) || (isSymbol(val2))) {'?
/Users/gbrail/src/rhino/rhino/src/main/java/org/mozilla/javascript/ScriptRuntime.java:3995: warning: [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them
if ((isSymbol(val1)) || (isSymbol(val2))) {
^
(see https://errorprone.info/bugpattern/UnnecessaryParentheses)
Did you mean 'if ((isSymbol(val1)) || isSymbol(val2)) {'?

9664e77, e17cc25)

* more standard compliant implementation of ScriptRuntime.toPrimitive();
  * have not used the Optional for more backward compatibility
  * have changed the code a bit to be more in sync with the spec (explicit if stmt's)
* improved support for Symbol/BigInt in equals and compare

I did this to make it possible to merge this improvement soon - at least this is my hope. Will extract more smaller commits if this is merged.
@rbri
Copy link
Collaborator Author

rbri commented Oct 1, 2024

errorprone done and rebased

@gbrail
Copy link
Collaborator

gbrail commented Oct 2, 2024

Great, thanks!

@gbrail gbrail merged commit 4e0b69b into mozilla:master Oct 2, 2024
1 check passed
@rbri rbri deleted the toPrimitive branch October 2, 2024 06:44
rbri added a commit to HtmlUnit/rhino-development that referenced this pull request Oct 3, 2024
fix s stupid bug in the toPrimitive() implementation introduced in mozilla#1661
rbri added a commit to HtmlUnit/rhino-development that referenced this pull request Oct 4, 2024
fix s stupid bug in the toPrimitive() implementation introduced in mozilla#1661
rbri added a commit to HtmlUnit/rhino-development that referenced this pull request Oct 5, 2024
fix s stupid bug in the toPrimitive() implementation introduced in mozilla#1661
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants