Class WhileStatementGenerator

java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.WhileStatementGenerator
All Implemented Interfaces:
Function<EK9Parser.WhileStatementExpressionContext, List<IRInstr>>

public final class WhileStatementGenerator extends AbstractGenerator implements Function<EK9Parser.WhileStatementExpressionContext, List<IRInstr>>
Generates IR for while and do-while loops using CONTROL_FLOW_CHAIN. Currently handles simple while and do-while loops (no guards, statement form only).

Scope structure:

  Outer Scope (_scope_1): Loop wrapper for future guards
  Whole Loop Scope (_scope_2): Loop control structure
  Condition Iteration Scope (_scope_3): Condition temps, enters/exits each iteration
  Body Iteration Scope (_scope_4): Body execution, enters/exits each iteration

The outer scope pattern enables future guard and expression form support. Both condition and body use iteration scopes for tight memory management.