Class PrimitiveToEk9Conversion
java.lang.Object
org.ek9lang.compiler.phase7.synthesis.support.PrimitiveToEk9Conversion
THE single builder for the "wrap a primitive/Java value into its EK9 object via a static
_of factory" IR sequence — Integer._of(int), String._of(java.lang.String),
Boolean._of(boolean) and the like.
Reuse this; do NOT re-derive the CALL_STATIC _of + SCOPE_REGISTER
sequence inline — it was hand-rolled identically across the enum synthesis generators
(Equals/Compare/HashCode/String/Json/IsSet/IncrementDecrement), varying only in the wrapper type
name and the _of parameter type. The factory hands back a fresh object at +1 (Contract 2), so the
result is registered and NEVER retained. Emits:
resultVar = CALL_STATIC ek9Type._of(primitiveVar) SCOPE_REGISTER resultVar, scopeId
Hold an instance.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvert(String resultVar, String primitiveVar, String ek9TypeName, String ofParamType, SynthesisScope ctx) Build theek9Type._of(primitiveVar)static-call sequence with ARC ownership: the_offactory hands back a fresh object at +1, so the scope owns it (DROP_AT_EXIT) and nothing retains it.ofCall(String resultVar, String primitiveVar, String ek9TypeName, String ofParamType, SynthesisScope ctx) THEek9Type._of(primitiveVar)static call alone, for a caller that states the result's owner itself.
-
Constructor Details
-
PrimitiveToEk9Conversion
public PrimitiveToEk9Conversion()
-
-
Method Details
-
convert
public List<IRInstr> convert(String resultVar, String primitiveVar, String ek9TypeName, String ofParamType, SynthesisScope ctx) Build theek9Type._of(primitiveVar)static-call sequence with ARC ownership: the_offactory hands back a fresh object at +1, so the scope owns it (DROP_AT_EXIT) and nothing retains it.- Parameters:
resultVar- temp receiving the wrapped EK9 objectprimitiveVar- the primitive/Java value passed to_ofek9TypeName- fully-qualified name of the EK9 wrapper type (call receiver + return type)ofParamType- the_ofparameter type name (e.g.IRConstants.INTEGER)ctx- synthesis scope providing debug info + the scope id that owns the result- Returns:
- the IR instructions for the conversion
-
ofCall
-