Class TypeNameOrException
Optionally accepts a type resolver function for Scenario 3 parameterized type IR generation, where type parameter FQNs (e.g., "Module::Renderer::T") need to be substituted with concrete type FQNs (e.g., "org.ek9.lang::Integer").
-
Constructor Summary
ConstructorsConstructorDescriptionCreate with identity resolver (no type substitution).TypeNameOrException(Function<ISymbol, String> typeResolver) Create with a type resolver for Scenario 3 type parameter substitution. -
Method Summary
Modifier and TypeMethodDescriptiontypeSymbolOf(ISymbol symbol) THE type SYMBOL whose fully qualified nameapply(ISymbol)emits - deliberately the same returning-symbol rule, yielding the symbol rather than its name.
-
Constructor Details
-
TypeNameOrException
public TypeNameOrException()Create with identity resolver (no type substitution). -
TypeNameOrException
Create with a type resolver for Scenario 3 type parameter substitution.The resolver takes the type SYMBOL, not its name: a parameterised type's FQN is a one-way digest, so a nested parameterisation (
List of T) can only be re-pointed at its concrete counterpart structurally, from the symbol's type arguments. SeeIRGenerationContext#resolveTypeName(ISymbol).- Parameters:
typeResolver- Function that maps a type symbol to the concrete type FQN to emit
-
-
Method Details
-
apply
-
typeSymbolOf
THE type SYMBOL whose fully qualified nameapply(ISymbol)emits - deliberately the same returning-symbol rule, yielding the symbol rather than its name.Use this when a site both prints a type via
apply(ISymbol)and needs to read that same type (resolve a member on it, extract call metadata from the resolved callee). Mirroringapplyis the whole point: the two answers cannot then describe different types. Re-deriving the rule inline assymbolTypeOrException.apply(symbol)silently disagrees with the emitted name for anyIMayReturnSymbolthat has a returning symbol - so the CALL would name one type and carry another type's metadata.This is not a general "give me the receiver type" helper. For an
IMayReturnSymbolit yields the RETURN type - right for a call expression (foo()?tests the returned value), wrong if a bare function symbol is ever handed in as a call receiver. Where that matters, fix the caller's choice ofapply; do not silently diverge here.
-