Fix switch statement issue#97
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the switch statement code generation in src/compiler/code-generator.ts by reserving 4-byte placeholders for branch targets and patching them later with full 4-byte signed big-endian offsets. A critical issue was identified in the non-table switch (LOOKUPSWITCH) patching logic, where using caseLabels[k] to retrieve the target label can lead to index misalignment and incorrect branch targets or out-of-bounds errors. It is recommended to use caseLabelMap to look up the correct label for each case value instead.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Coverage report
Show files with reduced coverage 🔻
Test suite run success1134 tests passing in 64 suites. Report generated by 🧪jest coverage report action from be416fd |
Fixes #93