Class SynthesisedCallMetaData

java.lang.Object
org.ek9lang.compiler.phase7.calls.SynthesisedCallMetaData

public final class SynthesisedCallMetaData extends Object
THE way a phase-7 SYNTHESISED call site obtains its CallMetaDataDetails. Use this - never hand-write new CallMetaDataDetails(true, 0).

Call metadata (purity, complexity, side-effects) is a property of the callee, and for a callee that is part of the EK9 language surface it is a fact about the program: the user wrote as pure, phase 5 measured the complexity from their code, and an AI can change either by editing source. Fabricating a constant here asserts a measured-looking falsehood about user code - ? and <=> are user-overridable, so a hard-coded (true, 0) reports a user's impure or complex operator as pure with zero complexity. Phase 12 gates fusability on exactly this field, so a fabricated pure=true is strictly worse than no answer at all.

A site reaching for this must be calling a real EK9 method or operator. Compiler↔runtime plumbing (_true, _false, _ofTrue, _ofFalse, _set, _of, and the Ek9Async/Ek9Group/... stream helpers) has no EK9 symbol for the callee because it is not EK9 surface at all - it is the compiler's own lowering, which no edit can affect. Those sites must carry no metadata clause, not a fabricated one.

There are exactly TWO honest sources, in preference order: the resolved callee symbol (which carries the user's authored purity and phase 5's measured complexity), and - when the target declares no resolvable member - the OperatorMap declaration of that operator. Anything else is a fabrication. Failing both, this throws rather than silently reintroducing a default tuple.

See Also:
  • Constructor Details

  • Method Details

    • fromOperatorDeclaration

      public CallMetaDataDetails fromOperatorDeclaration(String methodName)
      THE OperatorMap-derived metadata for a declared EK9 operator - the second honest source, used when the target type carries no resolvable member for the callee.

      The live case is an operator on a function type: delegate? lowers to _isSet on a FunctionSymbol, which is not an aggregate and so has no members to resolve. Nothing is lost by reading the declaration instead of a symbol - a function's ? is fixed language surface, not something a user can override. This is the same derivation the parsed path uses for a path-B operator, and both callers share this method so the two cannot drift.

      Throws:
      CompilerException - when the name is not a declared operator either - then there is no honest source and the site is either a phase 3 gap or compiler plumbing
    • apply

      public CallMetaDataDetails apply(ISymbol targetType, String methodName)
      Metadata for a zero-argument call (operand._isSet(), resource._close()).
    • apply

      public CallMetaDataDetails apply(ISymbol targetType, String methodName, List<ISymbol> argumentTypes)
      Resolve methodName(argumentTypes) on targetType and read the metadata off the resolved callee.
      Parameters:
      targetType - the type the call is made ON, as a resolved SYMBOL (never an FQN String)
      methodName - the JVM method name (_isSet), EK9 name (?) or, for a constructor, the target type's unqualified name
      argumentTypes - resolved argument types, driving overload selection
      Returns:
      the callee's measured metadata
      Throws:
      CompilerException - when neither honest source has an answer