Class EnumEqualsGenerator
java.lang.Object
org.ek9lang.compiler.phase7.synthesis.AbstractSyntheticGenerator
org.ek9lang.compiler.phase7.synthesis.EnumEqualsGenerator
Generates synthetic IR for the enum _eq (==) operator.
Enum fields use Java primitives:
- _ordinal: int (primitive)
- _isEnumSet: boolean (primitive)
Unlike the class/record EqualsGenerator which compares field-by-field, enums compare their _ordinal values for equality by converting primitive ordinals to EK9 Integer and using _eq:
Boolean _eq(EnumType other): if !this._isSet() -> return unset if !other._isSet() -> return unset thisOrd = Integer._of(this._ordinal) otherOrd = Integer._of(other._ordinal) return thisOrd._eq(otherOrd)
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractSyntheticGenerator
AbstractSyntheticGenerator.ScopeSetup -
Field Summary
Fields inherited from class AbstractSyntheticGenerator
stackContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate(MethodSymbol operatorSymbol, AggregateSymbol aggregateSymbol) Methods inherited from class AbstractSyntheticGenerator
aggregateHasOperator, createDebugInfo, createSynthesisScope, generateAnyFieldSetGuard, generateBinaryOperatorGuards, generateBooleanBranch, generateBooleanReturnBlock, generateConstructorCall, generateConstructorCall, generateConstructorCall, generateConstructorCallWithArgs, generateFieldLoad, generateFieldLoad, generateFieldSetStatusCheck, generateIsSetGuard, generateIsSetGuard, generateLabelName, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCall, generateMethodCallNoArg, generateResultReturnBlock, generateResultReturnBlock, generateStringLiteralLoad, generateTempName, generateThisIsSetGuard, generateThisIsSetGuard, generateUnsetReturnBlock, generateUnsetReturnBlockWithLabel, generateUnsetReturnBlockWithLabel, generateVoidMethodCall, getBitsTypeName, getBooleanTypeName, getIntegerTypeName, getReturnBlockHelper, getStringTypeName, getSuperTypeName, getSyntheticFields, getTypeName, getVoidTypeName, initializeScope, initializeScopeNoReturn, isAnyType, isTraitType, superHasOperator
-
Constructor Details
-
EnumEqualsGenerator
EnumEqualsGenerator(IRGenerationContext stackContext)
-
-
Method Details
-
generate
-