From bebd14acc1f646c79702fca4f7081df30a49a66c Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Fri, 24 May 2019 14:48:55 +0200 Subject: [PATCH] add aset --- src/comp.c | 5 ++++- test/src/comp-tests.el | 18 ++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/comp.c b/src/comp.c index 5f250c81432..2e7ef4f077a 100644 --- a/src/comp.c +++ b/src/comp.c @@ -624,8 +624,11 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, break; case Baset: - printf("Baset\n"); + POP3; + res = jit_emit_call ("Faset", comp.lisp_obj_type, 3, args); + PUSH (gcc_jit_lvalue_as_rvalue (res)); break; + case Bsymbol_value: printf("Bsymbol_value\n"); break; diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index be131f7de76..769cd086b5a 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -85,14 +85,16 @@ (should (= (comp-tests-length-f) 3))) -(ert-deftest comp-tests-aref () - "Testing aref." - (defun comp-tests-aref-f () - (aref [1 2 3] 2)) - (byte-compile #'comp-tests-aref-f) - (native-compile #'comp-tests-aref-f) - - (should (= (comp-tests-aref-f) 3))) +(ert-deftest comp-tests-aref-aset () + "Testing aref and aset." + (defun comp-tests-aref-aset-f () + (let ((vec [1 2 3])) + (aset vec 2 100) + (aref vec 2))) + (byte-compile #'comp-tests-aref-aset-f) + (native-compile #'comp-tests-aref-aset-f) + + (should (= (comp-tests-aref-aset-f) 100))) (ert-deftest comp-tests-ffuncall () "Testing varset." -- 2.39.5