Class DirectionCheckBuilder

java.lang.Object
org.ek9lang.compiler.phase7.support.DirectionCheckBuilder
All Implemented Interfaces:
Function<DirectionCheckParams, ConditionEvaluationResult>

public final class DirectionCheckBuilder extends Object implements Function<DirectionCheckParams, ConditionEvaluationResult>
CONCERN: Direction check evaluation for polymorphic for-range loops. RESPONSIBILITY: Build direction check IR (direction < 0 or direction > 0). REUSABILITY: FOR_RANGE_POLYMORPHIC ascending/descending case generation.

Domain-specific helper that eliminates the symmetric duplication between: - generateDirectionLessThanZero (direction < 0) - generateDirectionGreaterThanZero (direction > 0)

The only difference between these methods was the comparison operator ("<" vs ">"). This helper makes that difference explicit via DirectionCheckParams.

Pattern: 1. Load literal 0 2. Call direction < 0 (or > 0) 3. Extract primitive boolean result All wrapped in proper scope management and memory management.