Class IsVirtualCall

java.lang.Object
org.ek9lang.compiler.phase7.calls.IsVirtualCall
All Implemented Interfaces:
BiPredicate<ISymbol,ISymbol>

public final class IsVirtualCall extends Object implements BiPredicate<ISymbol,ISymbol>
THE virtual-dispatch decision of a resolved call (CallTargetResolution): false for constructors, private methods (cannot be overridden), and targets not open for extension (effectively final). LLVM-only - the JVM back-end ignores the flag and always emits INVOKEVIRTUAL / INVOKEINTERFACE. Hold an instance.

A call on a generic's bare T is always virtual. The body is generated ONCE, from the template, so the static type is T itself - which is never "open" - and every parameterisation shares the flag. But T stands for whatever parameterises it: in Walker of BigStep (T constrain by Step) step.label() resolves to Step.label, while the object is a BigStep that overrides it. Marked non-virtual, the native back-end called Step.label directly (runtimeFuzz genericConstructsCoverage, a for-range over a constrained T). The object decides which body runs.

  • Constructor Details

    • IsVirtualCall

      public IsVirtualCall()
  • Method Details

    • test

      public boolean test(ISymbol resolvedMethod, ISymbol targetType)
      Whether a call to resolvedMethod on targetType needs virtual (vtable) dispatch.
      Specified by:
      test in interface BiPredicate<ISymbol,ISymbol>
      Parameters:
      resolvedMethod - the method phase 3 resolved
      targetType - the receiver's static type