summaryrefslogtreecommitdiff
path: root/com.c
diff options
context:
space:
mode:
Diffstat (limited to 'com.c')
-rw-r--r--com.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/com.c b/com.c
index 0ae79f6..695802a 100644
--- a/com.c
+++ b/com.c
@@ -38,6 +38,7 @@ static int stack_effect_of(Op opcode) {
case OP_NIL:
case OP_TRUE:
case OP_FALSE:
+ case OP_ARRNEW:
return 1;
case OP_SKIP:
case OP_REDO:
@@ -55,6 +56,7 @@ static int stack_effect_of(Op opcode) {
case OP_CMP:
case OP_EQU:
case OP_MOD:
+ case OP_ARRAPPEND:
return -1;
// these ones depend on their argument. handle them specifically
@@ -402,6 +404,16 @@ static void compile_node(Compiler *C, AstNode a) {
compile_byte(C, compile_constant(C, VAL_OBJ(o)));
break;
}
+ case AST_ARR: {
+ compile_opcode(C, OP_ARRNEW);
+ AstVec v = a.as.list;
+ for (int i = 0; i < v.len; i++) {
+ compile_node(C, v.vals[i]);
+ compile_opcode(C, OP_ARRAPPEND);
+ }
+ break;
+ }
+
case AST_LIST: {
AstVec l = a.as.list;