Class BinaryOperationGenerator
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.BinaryOperationGenerator
- All Implemented Interfaces:
Function<ExprProcessingDetails, List<IRInstr>>
public final class BinaryOperationGenerator
extends AbstractGenerator
implements Function<ExprProcessingDetails, List<IRInstr>>
Generates IR instructions for binary operations (e.g., addition, subtraction, comparison, etc.).
Handles:
- Left and right operand evaluation with proper memory management
- Cost-based method resolution with automatic promotion
- CallInstr.operator generation for binary 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
ConstructorsConstructorDescriptionBinaryOperationGenerator(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
-
BinaryOperationGenerator
BinaryOperationGenerator(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 (a + b) - (c * d).
-