Design a transpiler context for labels and local variables
Author: pardeikeCreated Sep 8, 2026Updated Sep 8, 2026
Labelsenhancementneeds more info/work
Design for the Harmony 3 backlog.
A transpiler receives ILGenerator to define labels and declare locals, although it should return CodeInstructions rather than emit directly through that generator. The current API exposes operations that are inappropriate in a transpiler.
Design a small injectable context with the supported label/local operations, building on the use case in #317.
Completion criteria:
- Define label/local ownership, access to existing local metadata, pinned locals and compatibility with CodeMatcher.
- Keep existing ILGenerator-based transpilers working; specify any warnings or migration guidance without changing them silently.
- Integrate with instruction conversion between loaded Harmony versions.
- Separate safe declaration/inspection from whole-body import or deletion of Harmony-owned locals.
- Demonstrate a small prototype and focused compatibility tests before accepting the public API.
A wrapper around the existing generator is a valid candidate. Replacing all Reflection.Emit types is a separate architectural investigation.
Follow-up to #586 and #317. Current transpiler injection; CodeMatcher helpers.
Source: pardeike/Harmony