Skip to content

Implement spread for arrays#2098

Merged
gbrail merged 16 commits into
mozilla:masterfrom
0xe:scratch/array-spread
Nov 15, 2025
Merged

Implement spread for arrays#2098
gbrail merged 16 commits into
mozilla:masterfrom
0xe:scratch/array-spread

Conversation

@0xe

@0xe 0xe commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

TODO:

  • Objects with [Symbol.iterator] implementations should work correctly
  • skipIndices

@andreabergia and I have been working on this for a while. We plan to tackle spread for function calls in a subsequent change.

@0xe 0xe changed the title Scratch/array spread Implement ... for arrays Sep 24, 2025
@0xe 0xe changed the title Implement ... for arrays Implement spread for arrays Sep 24, 2025
@0xe
0xe force-pushed the scratch/array-spread branch 2 times, most recently from 4ce9215 to 52dd712 Compare October 6, 2025 11:45
@0xe
0xe force-pushed the scratch/array-spread branch from 17c664b to 959c4f5 Compare October 7, 2025 08:21
Comment thread rhino/src/main/java/org/mozilla/javascript/NewLiteralStorage.java Outdated
@0xe
0xe force-pushed the scratch/array-spread branch from 959c4f5 to 1b8f8a7 Compare October 10, 2025 07:27
@0xe
0xe force-pushed the scratch/array-spread branch 4 times, most recently from 77d4e23 to 3ffbbda Compare October 28, 2025 09:09
@0xe
0xe marked this pull request as ready for review October 28, 2025 09:09
// Per spec, if Symbol.iterator exists, use it. Let exceptions propagate.
final Object iterator = ScriptRuntime.callIterator(src, cx, scope);
if (!Undefined.isUndefined(iterator)) {
java.util.List<Object> spreadValues = new java.util.ArrayList<>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

import?

@0xe
0xe force-pushed the scratch/array-spread branch from 3ffbbda to 03cf04a Compare October 28, 2025 11:50
@0xe
0xe requested a review from rbri October 28, 2025 11:56
@rbri

rbri commented Oct 28, 2025

Copy link
Copy Markdown
Collaborator

@0xe have to do an HtmlUnit release first, will try this afterwards, maybe at he end of the week

@rbri

rbri commented Nov 8, 2025

Copy link
Copy Markdown
Collaborator

@0xe i like to do a smoke test for this with HtmlUnit, it will be great if you can rebase this to the head

@0xe
0xe force-pushed the scratch/array-spread branch from 03cf04a to c2573f2 Compare November 10, 2025 04:42
@0xe

0xe commented Nov 10, 2025

Copy link
Copy Markdown
Contributor Author

I think the Android test failures are unrelated. I see errors trying to install the emulator:

  Installing latest emulator.
  /usr/bin/sh -c \sdkmanager --install emulator --channel=0 > /dev/null
  Warning: An error occurred while preparing SDK package Android Emulator: Server returned HTTP response code: 502 for URL: https://dl.google.com/android/repository/emulator-linux_x64-14214601.zip.
Terminate Emulator
  /usr/local/lib/android/sdk/platform-tools/adb -s emulator-5554 emu kill
  error: could not connect to TCP port 5554: Connection refused
  The process '/usr/local/lib/android/sdk/platform-tools/adb' failed with exit code 1
Error: The process '/usr/bin/sh' failed with exit code 1

@rbri

rbri commented Nov 10, 2025

Copy link
Copy Markdown
Collaborator

@0xe smoke test with HtmlUnit was successful!

@0xe
0xe force-pushed the scratch/array-spread branch from 1712227 to ea36fd6 Compare November 12, 2025 04:54
@gbrail

gbrail commented Nov 15, 2025

Copy link
Copy Markdown
Collaborator

This works for me and I don't see anything concerning. I'm going to merge it and keep moving forward. Thanks!

@gbrail
gbrail merged commit f3bda3a into mozilla:master Nov 15, 2025
11 checks passed
@andreabergia
andreabergia deleted the scratch/array-spread branch November 17, 2025 16:01
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.

4 participants