Class CallTargetResolution
java.lang.Object
org.ek9lang.compiler.phase7.calls.CallTargetResolution
THE single source of truth for the descriptor OWNER and dispatch of a resolved call: the type where a
resolved method's body is actually emitted (its "defining type") and the virtual-dispatch decision.
Reuse this from BOTH the resolved-method path (
CallDetailsBuilder) and the chained
object-access path (ObjectAccessInstrGenerator) so the two never re-derive - and drift on - the CALL
descriptor owner. See docs/ir-and-codegen/EK9_UNIFIED_CALL_TARGET_RESOLUTION_DESIGN.md.
Invariant (enforced by the JVM back-end): the descriptor owner type and isTraitCall move
TOGETHER - INVOKEINTERFACE iff the owner is an interface (trait / Any) - so a caller derives
BOTH from the SAME definingType(ISymbol, ISymbol): targetType = definingType and
isTraitCall = TraitCall.requiredFor(definingType) (never one from the defining type and the
other from the static receiver).
-
Method Summary
Modifier and TypeMethodDescriptionstatic ISymboldefiningType(ISymbol resolvedMethod, ISymbol staticType) The type that DECLARES the resolved method (its enclosing scope) - i.e.static booleanisOpenAggregate(ISymbol type) Whether an aggregate type is open for extension (can have subclasses).static booleanisVirtualCall(ISymbol resolvedMethod, ISymbol targetType) Whether the call needs virtual (vtable) dispatch:falsefor constructors, private methods (cannot be overridden), and targets not open for extension (effectively final).
-
Method Details
-
definingType
The type that DECLARES the resolved method (its enclosing scope) - i.e. where its body is emitted. For an inherited method this is the PARENT, not the static receiver: the descriptor owner must name the declaring type because the native back-end resolves by the mangled(type, member)name and the body exists only on the declaring type (the JVM tolerates either spelling). Falls back tostaticTypewhen a defining scope cannot be determined. -
isVirtualCall
Whether the call needs virtual (vtable) dispatch:falsefor 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. -
isOpenAggregate
Whether an aggregate type is open for extension (can have subclasses). Traits are always "open" - implementations override them.
-