Class StringInterpolationAsmGenerator

java.lang.Object
org.ek9lang.compiler.backend.jvm.AbstractAsmGenerator
org.ek9lang.compiler.backend.jvm.StringInterpolationAsmGenerator
All Implemented Interfaces:
Consumer<StringInterpolationInstr>

final class StringInterpolationAsmGenerator extends AbstractAsmGenerator implements Consumer<StringInterpolationInstr>
Generates JVM bytecode for STRING_INTERPOLATION IR instructions.

Each part is materialised as an org.ek9.lang.String (literals via String._of(java.lang.String); variable parts are already EK9 Strings produced by the instruction's setup $ conversions) and the parts are folded left with the EK9 + operator String._add(String).

Using String._add (rather than StringConcatFactory/toString()) is deliberate: EK9 is tri-state, and +/$ propagate unset. An interpolation is sugar for "lit" + $x + "lit", so any UNSET part must yield an UNSET String — the same behaviour as the native backend and the +/$ operators. StringConcatFactory would coalesce an unset part to "" (via toString()), silently breaking tri-state.