Class AssertDoesNotThrowExprGenerator
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.AbstractAssertExprGenerator
org.ek9lang.compiler.phase7.generator.AssertDoesNotThrowExprGenerator
- All Implemented Interfaces:
Function<EK9Parser.AssertDoesNotThrowExpressionContext, List<IRInstr>>
public final class AssertDoesNotThrowExprGenerator
extends AbstractAssertExprGenerator
implements Function<EK9Parser.AssertDoesNotThrowExpressionContext, List<IRInstr>>
IR Generation for the assertDoesNotThrow expression.
Generates ASSERT_DOES_NOT_THROW opcode for test assertions that expect no exception.
Grammar: assertDoesNotThrowExpression: ASSERT_DOES_NOT_THROW LPAREN expression RPAREN
Semantics:
- Evaluates the expression within a try block
- If no exception thrown, assertion passes (returns Void)
- If any exception thrown, throws AssertionError with exception details
Used primarily in statement form:
assertDoesNotThrow(safeOperation())
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractAssertExprGenerator
AbstractAssertExprGenerator.AssertBodyResult -
Field Summary
Fields inherited from class AbstractAssertExprGenerator
generatorsFields inherited from class AbstractGenerator
debugInfoCreator, instructionBuilder, MAX_MESSAGE_LENGTH, stackContext, typeNameOrException -
Constructor Summary
ConstructorsConstructorDescriptionAssertDoesNotThrowExprGenerator(IRGenerationContext stackContext, GeneratorSet generators) Constructor accepting injected GeneratorSet. -
Method Summary
Modifier and TypeMethodDescriptionGenerate IR for assertDoesNotThrow expression.Methods inherited from class AbstractAssertExprGenerator
buildAssertionBodyMethods inherited from class AbstractGenerator
createTempVariable, createTempVariableFromContext, extractReturnType, getRecordedSymbolOrException, processBlockStatements, truncateMessage, truncateMessage, validateNoPreFlowStatement, validateStatementFormOnly
-
Constructor Details
-
AssertDoesNotThrowExprGenerator
AssertDoesNotThrowExprGenerator(IRGenerationContext stackContext, GeneratorSet generators) Constructor accepting injected GeneratorSet.
-
-
Method Details
-
apply
Generate IR for assertDoesNotThrow expression.- Specified by:
applyin interfaceFunction<EK9Parser.AssertDoesNotThrowExpressionContext, List<IRInstr>>- Parameters:
ctx- The ANTLR context for the assertDoesNotThrow expression- Returns:
- List of IR instructions
-