Skip to content

refactor: extract string and array dispatch chains from generate()#127

Merged
cs01 merged 1 commit intomainfrom
fix/extract-string-array-dispatch
Mar 8, 2026
Merged

refactor: extract string and array dispatch chains from generate()#127
cs01 merged 1 commit intomainfrom
fix/extract-string-array-dispatch

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 8, 2026

Summary

  • Extracts the 23-block string method dispatch chain from generate() into dispatchStringMethod() in new file string-dispatch.ts
  • Extracts the 16-block array method dispatch chain into dispatchArrayMethod() in the same file
  • Reduces consecutive if-return blocks in generate() from 39+ to 2, mitigating the native compiler's if-drop bug
  • Preserves fall-through semantics: methods like concat, slice, includes that handle both string and array cases return null to allow the array dispatcher to handle them

Test plan

  • All 433 tests pass (test:node)
  • Self-hosting verification passes (verify:quick)
  • Prettier formatting passes
  • Pure refactor — no behavioral changes

🤖 Generated with Claude Code

@cs01 cs01 merged commit c15fe4a into main Mar 8, 2026
12 checks passed
@cs01 cs01 deleted the fix/extract-string-array-dispatch branch March 9, 2026 04:16
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