KOS_OP_VAR_NEXT

  • Style: EXTRA (VAR, COUNT). Row = iterator name (pool), n (1 or 2).

  • Stack: n=1: [...] -> [..., value]; n=2: [..., default] -> [..., value-or-default]. Fused VAR + OBJECT_NEXT: resolve the iterator name and take the next element as OBJECT_NEXT does. A Koskari async generator runs flattened in the same evaluator; an awaited step suspends the frame and completes the instruction when it resumes. 1-arg raises StopIteration on exhaustion; 2-arg delivers the default.

  • Invariants: The fused name resolution runs after the default row (the fusion requires a bare default feeder, so the reorder is unobservable beyond NameError timing).

  • Compiler form: Produced by ByteCodeProcessor.fuse_feeders when OBJECT_NEXT’s iterator feeder is a bare VAR load (the 2-arg form also requires a bare VAR/CONST default). Lowers to FAST_NEXT through the generic schema-driven convert_fast path.

  • Implementation: koskari/lib/opcode/VAR_NEXT.c (cold handler)