Class CallDetailsFactory

java.lang.Object
org.ek9lang.compiler.phase7.support.CallDetailsFactory

public final class CallDetailsFactory extends Object
Static factories for the recurring CallDetails shapes in IR generation.

CallDetails is a ten-argument record; the overwhelming majority of call sites build a non-virtual, non-trait, non-explicit-trait-default call (the trailing false, false, false). Constructor calls additionally repeat the type name three times (target object, target type and return type are all the constructed type) with the IRConstants.INIT_METHOD method. These factories single-source those shapes so the boolean tail and the type-name repetition are written once.

Sites that genuinely need a virtual / trait / explicit-trait-default call keep the explicit new CallDetails(...) so the non-default flags stay visible at the call site.

  • Method Details

    • call

      public static CallDetails call(String targetObject, String targetTypeName, String methodName, List<String> parameterTypes, String returnTypeName, List<String> arguments, CallMetaDataDetails metaData)
      A non-virtual, non-trait call to methodName on targetObject.
      Parameters:
      targetObject - the receiver variable (or null for a static/free call)
      targetTypeName - the type that defines the method
      methodName - the (mangled) method name
      parameterTypes - the declared parameter types
      returnTypeName - the declared return type
      arguments - the argument variables
      metaData - purity / complexity / side-effect metadata
    • constructorCall

      public static CallDetails constructorCall(String typeName, List<String> parameterTypes, List<String> arguments, CallMetaDataDetails metaData)
      A constructor call on typeName: target object, target type and return type are all typeName and the method is IRConstants.INIT_METHOD.
    • defaultConstructorCall

      public static CallDetails defaultConstructorCall(String typeName, CallMetaDataDetails metaData)
      The no-argument default constructor call on typeName.