Class UnaryOperationGenerator
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.UnaryOperationGenerator
- All Implemented Interfaces:
Function<ExprProcessingDetails, List<IRInstr>>
public final class UnaryOperationGenerator
extends AbstractGenerator
implements Function<ExprProcessingDetails, List<IRInstr>>
Generates IR instructions for unary operations (e.g., unary minus, increment, decrement, etc.).
Handles:
- Operand evaluation with proper memory management
- Cost-based method resolution with automatic promotion
- CallInstr.operator generation for unary method calls
PHASE 7 REFACTORING: Consolidated WithProcessor variant into single class. Now accepts optional expressionProcessor for recursive expression handling.
-
Field Summary
Fields inherited from class AbstractGenerator
debugInfoCreator, instructionBuilder, stackContext -
Constructor Summary
ConstructorsConstructorDescriptionUnaryOperationGenerator(IRGenerationContext stackContext, GeneratorSet generators) -
Method Summary
Modifier and TypeMethodDescriptionapply(ExprProcessingDetails details) processOperandExpression(EK9Parser.ExpressionContext operandExpr, VariableDetails operandDetails) Process operand expression using exprGenerator from generators struct.Methods inherited from class AbstractGenerator
createTempVariable, createTempVariableFromContext, extractReturnType, getRecordedSymbolOrException
-
Constructor Details
-
UnaryOperationGenerator
UnaryOperationGenerator(IRGenerationContext stackContext, GeneratorSet generators)
-
-
Method Details
-
apply
- Specified by:
applyin interfaceFunction<ExprProcessingDetails, List<IRInstr>>
-
processOperandExpression
List<IRInstr> processOperandExpression(EK9Parser.ExpressionContext operandExpr, VariableDetails operandDetails) Process operand expression using exprGenerator from generators struct. This allows handling complex nested expressions like -(-x) or -(a + b).
-