Record Class CallContext

java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.calls.CallContext

public record CallContext(ISymbol targetType, String targetVariable, String methodName, List<ISymbol> argumentTypes, List<String> argumentVariables, String scopeId, EK9Parser.CallContext parseContext) extends Record
Context information needed for resolving method calls and constructing CallDetails. Contains all the information needed to perform cost-based method resolution and parameter-by-parameter promotion checking.
  • Constructor Details

    • CallContext

      public CallContext(ISymbol targetType, String targetVariable, String methodName, List<ISymbol> argumentTypes, List<String> argumentVariables, String scopeId, EK9Parser.CallContext parseContext)
      Creates an instance of a CallContext record class.
      Parameters:
      targetType - the value for the targetType record component
      targetVariable - the value for the targetVariable record component
      methodName - the value for the methodName record component
      argumentTypes - the value for the argumentTypes record component
      argumentVariables - the value for the argumentVariables record component
      scopeId - the value for the scopeId record component
      parseContext - the value for the parseContext record component
  • Method Details

    • forBinaryOperation

      public static CallContext forBinaryOperation(ISymbol leftType, ISymbol rightType, String methodName, String leftVariable, String rightVariable, String scopeId)
      Create context for binary operation: left.method(right)
    • forUnaryOperation

      public static CallContext forUnaryOperation(ISymbol targetType, String methodName, String targetVariable, String scopeId)
      Create context for unary operation: target.method()
    • forFunctionCall

      public static CallContext forFunctionCall(ISymbol targetType, List<ISymbol> argumentTypes, String methodName, String targetVariable, List<String> argumentVariables, String scopeId, EK9Parser.CallContext parseContext)
      Create context for function call: function(args...)
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • targetType

      public ISymbol targetType()
      Returns the value of the targetType record component.
      Returns:
      the value of the targetType record component
    • targetVariable

      public String targetVariable()
      Returns the value of the targetVariable record component.
      Returns:
      the value of the targetVariable record component
    • methodName

      public String methodName()
      Returns the value of the methodName record component.
      Returns:
      the value of the methodName record component
    • argumentTypes

      public List<ISymbol> argumentTypes()
      Returns the value of the argumentTypes record component.
      Returns:
      the value of the argumentTypes record component
    • argumentVariables

      public List<String> argumentVariables()
      Returns the value of the argumentVariables record component.
      Returns:
      the value of the argumentVariables record component
    • scopeId

      public String scopeId()
      Returns the value of the scopeId record component.
      Returns:
      the value of the scopeId record component
    • parseContext

      public EK9Parser.CallContext parseContext()
      Returns the value of the parseContext record component.
      Returns:
      the value of the parseContext record component