Skip to main content

set_list_code

Function set_list_code 

Source
pub fn set_list_code(p: usize, type_code: i32, cmplx: bool)
Expand description

Patch a list-placeholder wordcode with its actual opcode + jump distance. Direct port of zsh/Src/parse.c:738 set_list_code. zsh emits an ecadd(0) placeholder before par_sublist runs, then comes back through set_list_code to rewrite the slot with WCB_LIST(type, distance) once the sublist’s final length is known.

Port of set_list_code(int p, int type, int cmplx) from Src/parse.c:738. Patches the WCB_LIST header at p based on whether the sublist body is simple (single command, no pipeline) and Z_SYNC/Z_END — emits the Z_SIMPLE-optimized header when possible, otherwise the plain WCB_LIST(type, 0).