Class ConditionStatementPrelude

java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.ConditionStatementPrelude

final class ConditionStatementPrelude extends AbstractGenerator
THE prelude of a condition statement - assert and require (OPS-7): the statement coverage probe, the debug info that is ALWAYS created (the source location is essential for reporting a failure, not just for debugging), the truncated expression text for the failure message, the condition evaluated into a managed temporary (optionally bracketed by the coverage assert window) and its primitive Boolean. The two statements differ only in what they do with the primitive afterwards - never repeat this sequence.
  • Constructor Details

  • Method Details

    • evaluate

      ConditionStatementPrelude.Evaluated evaluate(org.antlr.v4.runtime.tree.ParseTree statement, org.antlr.v4.runtime.Token keyword, EK9Parser.ExpressionContext expression, boolean assertWindow)
      Evaluate the condition of the statement.
      Parameters:
      statement - The statement, for its coverage probe.
      keyword - The statement's keyword token, which anchors the debug info.
      expression - The condition.
      assertWindow - True for assert: bracket the condition with the coverage assert window (when enabled) so an input-class probe firing inside it commits an asserted cell as well as a driven one - what credits assert someCall(x) == expected.