Record Class PromotionParams
java.lang.Object
java.lang.Record
org.ek9lang.compiler.phase7.support.PromotionParams
- Record Components:
sourceType- The type of the value being promoted (e.g., Integer)sourceVariable- The variable name holding the value to promotedebugInfo- Debug information for generated instructionsescaping- Whether the promoted value escapes the current scope (RETAIN-only) or is scope-local (RETAIN + SCOPE_REGISTER)
public record PromotionParams(ISymbol sourceType, String sourceVariable, DebugInfo debugInfo, boolean escaping)
extends Record
Parameters for type promotion invocation using the #^ operator.
Encapsulates all data needed to generate a _promote() call with proper memory management.
escaping selects the ARC treatment of the promoted value, kept EXPLICIT in the IR so a
later IR-optimisation pass (phase 12) can see the value's lifetime and stack-allocate it, eliding
RETAIN/RELEASE, when it does not escape:
false(default): the promoted value is scope-local — a list/dict element, a range bound, a comparison operand — consumed in this scope by a consumer that takes its own retain. RETAIN + SCOPE_REGISTER; released at scope exit.true: the promoted value ESCAPES the current scope (e.g. a coalescing body-result that becomes the expression's value). RETAIN only, no SCOPE_REGISTER; the consumer takes ownership — the same producer pattern the chain already uses for its escaping operands.
-
Constructor Summary
ConstructorsConstructorDescriptionPromotionParams(ISymbol sourceType, String sourceVariable, DebugInfo debugInfo) Non-escaping (scope-local) promotion — the common case (list/dict element, range bound, comparison operand).PromotionParams(ISymbol sourceType, String sourceVariable, DebugInfo debugInfo, boolean escaping) Creates an instance of aPromotionParamsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedebugInforecord component.final booleanIndicates whether some other object is "equal to" this one.booleanescaping()Returns the value of theescapingrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thesourceTyperecord component.Returns the value of thesourceVariablerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
PromotionParams
-
PromotionParams
public PromotionParams(ISymbol sourceType, String sourceVariable, DebugInfo debugInfo, boolean escaping) Creates an instance of aPromotionParamsrecord class.- Parameters:
sourceType- the value for thesourceTyperecord componentsourceVariable- the value for thesourceVariablerecord componentdebugInfo- the value for thedebugInforecord componentescaping- the value for theescapingrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
sourceType
Returns the value of thesourceTyperecord component.- Returns:
- the value of the
sourceTyperecord component
-
sourceVariable
Returns the value of thesourceVariablerecord component.- Returns:
- the value of the
sourceVariablerecord component
-
debugInfo
-
escaping
-