Record Class ChainedCallDispatch

java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.calls.ChainedCallDispatch
Record Components:
receiver - the CALL's target object - the literal super for a super call
targetTypeName - the type the call names (see of(MethodSymbol, String, ISymbol, boolean, boolean, IRGenerationContext))
isVirtualCall - the call dispatches on the receiver's runtime type
isTraitCall - the named type compiles to an interface - read off the SAME type that targetTypeName names
isExplicitTraitDefaultCall - TraitName.m() on a trait method with a default body: that body, directly
isExternTarget - the named type is externally linked (IsExternallyLinked), read off the SAME type that targetTypeName names

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 Details

    • ChainedCallDispatch

      public ChainedCallDispatch(String receiver, String targetTypeName, boolean isVirtualCall, boolean isTraitCall, boolean isExplicitTraitDefaultCall, boolean isExternTarget)
      Creates an instance of a ChainedCallDispatch record class.
      Parameters:
      receiver - the value for the receiver record component
      targetTypeName - the value for the targetTypeName record component
      isVirtualCall - the value for the isVirtualCall record component
      isTraitCall - the value for the isTraitCall record component
      isExplicitTraitDefaultCall - the value for the isExplicitTraitDefaultCall record component
      isExternTarget - the value for the isExternTarget record 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 to toBeCalled on receiverType is dispatched.
      Parameters:
      toBeCalled - the method phase 3 resolved
      receiverTemp - the temporary holding the receiver
      receiverType - the receiver's static type
      isExplicitTraitTypeRef - the receiver is an explicit trait type reference (TraitName.m())
      isSuperCall - the call is super.m()
      stackContext - the generation in progress (Scenario-3 type resolution)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • receiver

      public String receiver()
      Returns the value of the receiver record component.
      Returns:
      the value of the receiver record component
    • targetTypeName

      public String targetTypeName()
      Returns the value of the targetTypeName record component.
      Returns:
      the value of the targetTypeName record component
    • isVirtualCall

      public boolean isVirtualCall()
      Returns the value of the isVirtualCall record component.
      Returns:
      the value of the isVirtualCall record component
    • isTraitCall

      public boolean isTraitCall()
      Returns the value of the isTraitCall record component.
      Returns:
      the value of the isTraitCall record component
    • isExplicitTraitDefaultCall

      public boolean isExplicitTraitDefaultCall()
      Returns the value of the isExplicitTraitDefaultCall record component.
      Returns:
      the value of the isExplicitTraitDefaultCall record component
    • isExternTarget

      public boolean isExternTarget()
      Returns the value of the isExternTarget record component.
      Returns:
      the value of the isExternTarget record component