Class CollectionLiteralRendering

java.lang.Object
org.ek9lang.compiler.ir.instructions.CollectionLiteralRendering

final class CollectionLiteralRendering extends Object
Shared IR-text rendering for the element setup of collection-literal instructions (LIST_LITERAL / DICT_LITERAL).

The setup instructions evaluate each element (and any #^ promotion required to widen an element to the collection's resolved element type) and manage its memory. Rendering them - rather than hiding them inside the instruction - keeps the IR text faithful and makes promotions explicit, so @IR directive tests assert them directly and catch regressions. Mirrors the nested-block style used by CONTROL_FLOW_CHAIN.

  • Method Details

    • appendSetupBlock

      static void appendSetupBlock(StringBuilder sb, List<IRInstr> setupInstructions, String scopeId)
      Append the element_setup block for a collection literal, if it has any setup.
      Parameters:
      sb - builder receiving the rendered block
      setupInstructions - the element/key/value evaluation + promotion + memory instructions
      scopeId - the scope the setup executes within