Skip to content

fix: ts parser populates topLevelItemTypes, codegen handles top-level switch#406

Merged
cs01 merged 1 commit intomainfrom
fix/ts-parser-missing-toplevel-types
Mar 15, 2026
Merged

fix: ts parser populates topLevelItemTypes, codegen handles top-level switch#406
cs01 merged 1 commit intomainfrom
fix/ts-parser-missing-toplevel-types

Conversation

@cs01
Copy link
Owner

@cs01 cs01 commented Mar 15, 2026

Summary

  • TS parser was never populating topLevelItemTypes array, causing it to be empty while topLevelItems had entries. This could cause type mismatches when getTopLevelItemType() fell through to inspecting item.type
  • Added topLevelItemTypes pushes for all top-level statement types (variable declarations, expressions, assignments, for/for-of/while/do-while/if/try/switch)
  • Added "switch" case to processTopLevelItem() in codegen — previously a top-level switch would fall through to generateExpression() which doesn't handle statements

Test plan

  • npm run verify:quick passes (tests + Stage 1 self-hosting)
  • No new test failures

@cs01 cs01 merged commit 938f7f4 into main Mar 15, 2026
12 checks passed
@cs01 cs01 deleted the fix/ts-parser-missing-toplevel-types branch March 15, 2026 00:34
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