Class SetupBlockRendering
The setup instructions evaluate each sub-expression - and any #^ promotion or
_string() conversion it needs - and manage its memory. Rendering them, rather than hiding
them inside the instruction, keeps the IR text faithful and makes promotions and dispatch explicit,
so @IR directive tests assert them directly and catch regressions. Mirrors the nested-block
style used by CONTROL_FLOW_CHAIN.
There is a real balance here between IR text that is readable and IR text that is complete. Hiding
a lowering step puts it beyond the reach of every @IR golden: an instruction whose rendered
form is identical before and after a defect is fixed cannot gate anything. STRING_INTERPOLATION was
on the wrong side of that balance - four text-body goldens sat green over a generator that emitted
the wrong conversion call, no promotion at all, and interface dispatch as INVOKEVIRTUAL, because
none of it was printed.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescription(package private) static voidappendSetupBlock(StringBuilder sb, String label, List<IRInstr> setupInstructions, String scopeId) Append a nested setup block, if there is any setup to show.
-
Field Details
-
ELEMENT_SETUP
Label for collection literals, whose setup evaluates each element.- See Also:
-
EXPRESSION_SETUP
Label for string interpolation, whose setup converts each expression part to a String.- See Also:
-
-
Method Details
-
appendSetupBlock
static void appendSetupBlock(StringBuilder sb, String label, List<IRInstr> setupInstructions, String scopeId) Append a nested setup block, if there is any setup to show.- Parameters:
sb- builder receiving the rendered blocklabel- the block label -ELEMENT_SETUPorEXPRESSION_SETUPsetupInstructions- the sub-expression evaluation + promotion + memory instructionsscopeId- the scope the setup executes within
-