Skip to content

Regroup IrToTsClassBridge into thematic partial/static classes #223

Description

@danfma

Problem

`src/Metano.Compiler.TypeScript/Bridge/IrToTsClassBridge.cs` — 991 LOC, 22 public statics covering header / members / constructors / operators / object-args / record-synthesis. Stuffed bag.

`IrToTsClassEmitter.Transform` (sibling, 230 LOC) carries 3 constructor strategies + params-rest field promotion + four-arm member walk + object-args factory + record synthesis + abstract-suppression heuristic inline.

Fix

Same call sites, smaller per-file surface:

  • `ClassHeader` — Extends/Implements/TypeParameters
  • `ClassMembers` — BuildProperty/BuildMethod/BuildField/BuildEvent
  • `ClassConstructor` — BuildSimpleConstructor/BuildPromotedCtorParams/BuildCapturedCtorParams/ResolveCtorParamDefault
  • `ClassOperators` — BuildOperator/BuildOperatorDispatcher/MapOperatorKindToName
  • `ClassObjectArgs` — BuildObjectArgsMethod/BuildObjectArgsCreateFactory

Split `IrToTsClassEmitter.Transform` into `BuildConstructor` / `BuildMemberList` / `BuildSynthesizedMembers` / `BuildPromotedParamsFields`.

Motivation

Recurring drift between class bridge and emitter (record synthesis, object-args, operator dispatch) — each lives in a different 100-LOC arm of one big method. Bob's audit flagged it as the textbook Replace-Conditional-with-Polymorphism opportunity.

Pure refactor. Golden tests must stay byte-identical.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions