Skip to content

Extract a ResolveVariableStorage helper (the 8-rung ladder + increment god-methods) #1127

Description

@nickna

Location: ILEmitter.Operators.cs:1044-1366 (EmitPrefixIncrement ~322 lines) and :1366-1705 (EmitPostfixIncrement ~339 lines); the same ladder re-coded in ILEmitter.Expressions.cs/.Statements.cs/.Calls.Closures.cs; the two IVariableResolver impls StateMachineVariableResolver.cs and AsyncArrowVariableResolver.cs.

Problem: the identical ~8-rung "where does this variable live" ladder (cell-binding → function/arrow/top-level display-class → IL local → captured field → static) is walked in 6+ places that drift independently — a real correctness-drift surface (a rung fixed in one method but not the others).

Action: extract ResolveVariableStorage(name) → (StorageKind, load/store closures) and route prefix/postfix/assign/compound/store + both resolvers through it.

Part of #1091

Metadata

Metadata

Assignees

No one assigned

    Labels

    tech-debtCode maintainability / tech-debt cleanup

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions