#include "compile-node.h" static const struct compile_value_type array_type = {}; static const struct compile_value_type array_item_type = {}; struct compile_result compile_array( struct compile_ctx *ctx, struct bshell_ast_node *src) { struct bshell_array_ast_node *array; array = (struct bshell_array_ast_node *)src; size_t nr_items = fx_queue_length(&array->n_items); for (size_t i = 0; i < nr_items; i++) { struct compile_value *item = compile_pop_value(ctx); compile_value_load(ctx, item); compile_value_destroy(item); } bshell_scriptblock_push_instruction( ctx->c_block, BSHELL_OPCODE_MK_ARRAY, nr_items); compile_push_value(ctx, &array_type, src); return COMPILE_OK(0); }