summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index 679a6a5..023d2c3 100644
--- a/vm.c
+++ b/vm.c
@@ -233,8 +233,23 @@ int runvm(State *S) {
goto done;
break;
+ case OP_ARRNEW: {
+ ObjArr *a = objarr_new(S);
+ PUSH(VAL_OBJ(a));
+ break;
+ }
+ case OP_ARRAPPEND: {
+ Val v = POP();
+ Val a = PEEK();
+ CHECK(IS_ARR(a), "can only append to array");
+ ObjArr *arr = AS_ARR(a);
+ objarr_append(S, arr, v);
+ break;
}
+ }
+
+
}
done:;
return status;