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 + RETAIN + 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. Emits:
resultVar = CALL_STATIC ek9Type._of(primitiveVar) RETAIN resultVar SCOPE_REGISTER resultVar, scopeId
-
Method Summary
-
Method Details
-
convert
public static List<IRInstr> convert(String resultVar, String primitiveVar, String ek9TypeName, String ofParamType, SynthesisScope ctx) Build theek9Type._of(primitiveVar)static-call sequence with ARC registration.- 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 forSCOPE_REGISTER- Returns:
- the IR instructions for the conversion
-