Class IncrementEvaluator

java.lang.Object
org.ek9lang.compiler.phase7.support.IncrementEvaluator
All Implemented Interfaces:
Function<IncrementParams, List<IRInstr>>

public final class IncrementEvaluator extends Object implements Function<IncrementParams, List<IRInstr>>
CONCERN: Loop counter increment/decrement. RESPONSIBILITY: Call increment/decrement operator which mutates the counter in place. REUSABILITY: ALL loop generators (for, while with increment).

The ++ and -- operators in EK9 are MUTATING operators that return VOID. They modify the target object in place - no return value, no assignment needed.

This pattern appears in: - ForRangeGenerator (loop counter increment/decrement) - WhileStatementGenerator (manual increment patterns)

  • Constructor Details

  • Method Details

    • apply

      public List<IRInstr> apply(IncrementParams params)
      Evaluate increment/decrement on the counter variable.

      The ++ and -- operators mutate the target in place and return void. No result storage is needed - the counter variable is modified directly.

      Specified by:
      apply in interface Function<IncrementParams, List<IRInstr>>
      Parameters:
      params - Increment parameters
      Returns:
      Instructions that mutate the counter variable in place