Class ConditionStatementPrelude
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.ConditionStatementPrelude
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final recordThe evaluated condition of an assert or require statement. -
Field Summary
Fields inherited from class AbstractGenerator
constantCopyOnAccessLoader, instructionBuilder, MAX_MESSAGE_LENGTH, stackContext, symbolTypeOrException, synthesisedCallMetaData, typeNameOrException, variableNameForIR -
Constructor Summary
ConstructorsConstructorDescriptionConditionStatementPrelude(IRGenerationContext stackContext, GeneratorSet generators, RecordExprProcessing recordExprProcessing) -
Method Summary
Modifier and TypeMethodDescription(package private) ConditionStatementPrelude.Evaluatedevaluate(org.antlr.v4.runtime.tree.ParseTree statement, org.antlr.v4.runtime.Token keyword, EK9Parser.ExpressionContext expression, boolean assertWindow) Evaluate the condition of the statement.
-
Constructor Details
-
ConditionStatementPrelude
ConditionStatementPrelude(IRGenerationContext stackContext, GeneratorSet generators, RecordExprProcessing recordExprProcessing)
-
-
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 forassert: bracket the condition with the coverage assert window (when enabled) so an input-class probe firing inside it commits anassertedcell as well as adrivenone - what creditsassert someCall(x) == expected.
-