diff --git a/snek-list.c b/snek-list.c index bb46863..cc214af 100644 --- a/snek-list.c +++ b/snek-list.c @@ -290,6 +290,19 @@ snek_list_imm(snek_offset_t size, snek_list_type_t type) return snek_list_to_poly(list); } +#ifdef SNEK_LIST_BUILD +snek_poly_t +snek_list_build(snek_list_type_t type, snek_offset_t size, ...) +{ + va_list args; + va_start(args, size); + snek_offset_t s = size; + while (s--) + snek_stack_push(va_arg(args, snek_poly_t)); + return snek_list_imm(size, type); +} +#endif + snek_list_t * snek_list_slice(snek_list_t *list, snek_slice_t *slice) { diff --git a/snek.h b/snek.h index 2b998eb..e981595 100644 --- a/snek.h +++ b/snek.h @@ -620,6 +620,11 @@ snek_list_mark(void *addr); void snek_list_move(void *addr); +#ifdef SNEK_LIST_BUILD +snek_poly_t +snek_list_build(snek_list_type_t type, snek_offset_t size, ...); +#endif + /* snek-lex.c */ extern uint8_t snek_lex_indent;