Class SamenessOverrideGenerator
java.lang.Object
org.ek9lang.compiler.phase7.synthesis.AbstractSyntheticGenerator
org.ek9lang.compiler.phase7.synthesis.SamenessOverrideGenerator
Generates the body of an override of an inherited
==(Super) or <=>(Super) on a type with its own
sameness (D24 rule 3, Sameness.overriddenSignatures(IAggregateSymbol, ISymbol), Contract 22): the OBJECT decides which comparison
runs, never the reference (N07).
_isOwner = INSTANCEOF other, Owner [SUBTYPE]
BRANCH_FALSE _isOwner, different_type
_narrowed = CAST other -> Owner ; RETAIN ; SCOPE_REGISTER
_result = CALL (Owner)this._eq|_cmp(_narrowed) ; SCOPE_REGISTER
STORE rtn, _result ; RETAIN rtn ; BRANCH return_result
different_type: rtn = false ('==') or unset ('<=>'); return
The narrowed value takes the RETAIN and SCOPE_REGISTER of the polymorphic copy's narrowing (Contract 20), the
result and return blocks those of every generated comparison - the override needs no ARC of its own beyond them.-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractSyntheticGenerator
AbstractSyntheticGenerator.CycleGuardEntry, AbstractSyntheticGenerator.ScopeSetup -
Field Summary
Fields inherited from class AbstractSyntheticGenerator
stackContext, synthesisedCallMetaData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerate(MethodSymbol operatorSymbol, AggregateSymbol aggregateSymbol) (package private) static booleanisOverride(MethodSymbol operatorSymbol, AggregateSymbol aggregateSymbol) Is this synthetic==or<=>one of the detached overrides - does it take a type other than its owner? A generated sameness always takes exactly its owner.Methods inherited from class AbstractSyntheticGenerator
aggregateHasOperator, constructorCall, createDebugInfo, createSynthesisScope, cycleTarget, differentTypeLabel, fieldTypeHasRealOperator, generateBinaryOperatorGuards, generateBooleanBranch, generateCycleGuardedRegion, generateCycleGuardEnter, generateFieldLoad, generateFieldLoad, generateFieldSetStatusCheck, generateIsSetGuard, generateIsSetGuard, generateLabelName, generatePoisonableCycleGuardedRegion, generateReplacingUnsetReturnBlockWithLabel, generateResultReturnBlock, generateResultReturnBlock, generateStringLiteralLoad, generateTempName, generateThisIsSetGuard, generateThisIsSetGuard, generateUnsetReturnBlockWithLabel, generateUnsetReturnBlockWithLabel, getAnyType, getAnyTypeName, getBitsType, getBitsTypeName, getBooleanType, getBooleanTypeName, getIntegerType, getIntegerTypeName, getReturnBlockHelper, getStringType, getStringTypeName, getSuperTypeName, getSyntheticFields, getType, getTypeName, getVoidTypeName, initializeScope, initializeScopeNoReturn, isAnyType, isTraitType, methodCall, nearestSuperOperator, needsCycleGuard, rendersNothing, returnVariableNameFor, runtimeTypeCheck, runUnderCycleGuard, servingOperatorParameterTypeName, superCallOwner, superCallParameterTypeName, superContributesRepresentation, superHasOperator
-
Constructor Details
-
SamenessOverrideGenerator
SamenessOverrideGenerator(IRGenerationContext stackContext)
-
-
Method Details
-
isOverride
Is this synthetic==or<=>one of the detached overrides - does it take a type other than its owner? A generated sameness always takes exactly its owner. -
generate
-