Record Class ChainedCallDispatch
java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.calls.ChainedCallDispatch
- Record Components:
receiver- the CALL's target object - the literalsuperfor a super calltargetTypeName- the type the call names (seeof(MethodSymbol, String, ISymbol, boolean, boolean, IRGenerationContext))isVirtualCall- the call dispatches on the receiver's runtime typeisTraitCall- the named type compiles to an interface - read off the SAME type thattargetTypeNamenamesisExplicitTraitDefaultCall-TraitName.m()on a trait method with a default body: that body, directlyisExternTarget- the named type is externally linked (IsExternallyLinked), read off the SAME type thattargetTypeNamenames
public record ChainedCallDispatch(String receiver, String targetTypeName, boolean isVirtualCall, boolean isTraitCall, boolean isExplicitTraitDefaultCall, boolean isExternTarget)
extends Record
THE dispatch decision of a method call made in an object-access CHAIN (
a.b().c(), super.m(),
TraitName.m()) - a pure function of the resolved method, the receiver's static type and the call's shape
(EXPR-17). ObjectAccessInstrGenerator.processChainedMethodCall asks it; it never decides the five facts
inline again.
It is kept apart from DispatchFacts.ofResolvedCall(ISymbol, ISymbol, ISymbol, boolean, TypeNameOrException, UnaryOperator) (the builder's route); both answer
isExternTarget the same way now (IR lane F): IsExternallyLinked of the type the call
NAMES.
-
Constructor Summary
ConstructorsConstructorDescriptionChainedCallDispatch(String receiver, String targetTypeName, boolean isVirtualCall, boolean isTraitCall, boolean isExplicitTraitDefaultCall, boolean isExternTarget) Creates an instance of aChainedCallDispatchrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisExplicitTraitDefaultCallrecord component.booleanReturns the value of theisExternTargetrecord component.booleanReturns the value of theisTraitCallrecord component.booleanReturns the value of theisVirtualCallrecord component.static ChainedCallDispatchof(MethodSymbol toBeCalled, String receiverTemp, ISymbol receiverType, boolean isExplicitTraitTypeRef, boolean isSuperCall, IRGenerationContext stackContext) Decide how a chained call totoBeCalledonreceiverTypeis dispatched.receiver()Returns the value of thereceiverrecord component.Returns the value of thetargetTypeNamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ChainedCallDispatch
public ChainedCallDispatch(String receiver, String targetTypeName, boolean isVirtualCall, boolean isTraitCall, boolean isExplicitTraitDefaultCall, boolean isExternTarget) Creates an instance of aChainedCallDispatchrecord class.- Parameters:
receiver- the value for thereceiverrecord componenttargetTypeName- the value for thetargetTypeNamerecord componentisVirtualCall- the value for theisVirtualCallrecord componentisTraitCall- the value for theisTraitCallrecord componentisExplicitTraitDefaultCall- the value for theisExplicitTraitDefaultCallrecord componentisExternTarget- the value for theisExternTargetrecord component
-
-
Method Details
-
of
public static ChainedCallDispatch of(MethodSymbol toBeCalled, String receiverTemp, ISymbol receiverType, boolean isExplicitTraitTypeRef, boolean isSuperCall, IRGenerationContext stackContext) Decide how a chained call totoBeCalledonreceiverTypeis dispatched.- Parameters:
toBeCalled- the method phase 3 resolvedreceiverTemp- the temporary holding the receiverreceiverType- the receiver's static typeisExplicitTraitTypeRef- the receiver is an explicit trait type reference (TraitName.m())isSuperCall- the call issuper.m()stackContext- the generation in progress (Scenario-3 type resolution)
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
receiver
-
targetTypeName
Returns the value of thetargetTypeNamerecord component.- Returns:
- the value of the
targetTypeNamerecord component
-
isVirtualCall
public boolean isVirtualCall()Returns the value of theisVirtualCallrecord component.- Returns:
- the value of the
isVirtualCallrecord component
-
isTraitCall
public boolean isTraitCall()Returns the value of theisTraitCallrecord component.- Returns:
- the value of the
isTraitCallrecord component
-
isExplicitTraitDefaultCall
public boolean isExplicitTraitDefaultCall()Returns the value of theisExplicitTraitDefaultCallrecord component.- Returns:
- the value of the
isExplicitTraitDefaultCallrecord component
-
isExternTarget
public boolean isExternTarget()Returns the value of theisExternTargetrecord component.- Returns:
- the value of the
isExternTargetrecord component
-