]> git.eshelyaron.com Git - emacs.git/commitdiff
add aset
authorAndrea Corallo <andrea_corallo@yahoo.it>
Fri, 24 May 2019 12:48:55 +0000 (14:48 +0200)
committerAndrea Corallo <akrl@sdf.org>
Wed, 1 Jan 2020 10:33:38 +0000 (11:33 +0100)
src/comp.c
test/src/comp-tests.el

index 5f250c81432586e7f7ca4be94357e56aa527566c..2e7ef4f077aed0d32b77c189383c7923d7390a01 100644 (file)
@@ -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;
index be131f7de768d0a1966cc4fc2e22307212e8ae5a..769cd086b5aecca857ef3cc3eb4c8c41e0110346 100644 (file)
 
   (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."