Skip to content

implement array.copyWithin() for numeric and string arrays#304

Merged
cs01 merged 1 commit intomainfrom
feat-array-copywithin
Mar 12, 2026
Merged

implement array.copyWithin() for numeric and string arrays#304
cs01 merged 1 commit intomainfrom
feat-array-copywithin

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 12, 2026

Summary

  • Adds array.copyWithin(target, start, end?) for both number[] and string[]
  • Properly resolves negative indices from end of array (JS spec compliant)
  • Uses llvm.memmove for correct overlapping copy semantics
  • Also fixes fill() negative index handling — now resolves from end instead of clamping to 0

Test plan

  • tests/fixtures/arrays/array-copywithin.ts — basic copy, range copy, string array, overlapping region
  • npm run verify:quick passes (tests + Stage 1 self-hosting)

🤖 Generated with Claude Code

@cs01 cs01 merged commit dfecb32 into main Mar 12, 2026
12 checks passed
@cs01 cs01 deleted the feat-array-copywithin branch March 12, 2026 21:24
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.

1 participant