1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-11 09:20:51 +00:00

add setcar setcdr

This commit is contained in:
Andrea Corallo 2019-06-11 23:47:16 +02:00 committed by Andrea Corallo
parent 5c406adac7
commit 3ee58c64e5
2 changed files with 26 additions and 2 deletions

View File

@ -1447,12 +1447,19 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
case Bnreverse:
error ("Bnreverse not supported");
break;
case Bsetcar:
error ("Bsetcar not supported");
POP2;
res = comp_emit_call ("Fsetcar", comp.lisp_obj_type, 2, args);
PUSH_LVAL (res);
break;
case Bsetcdr:
error ("Bsetcdr not supported");
POP2;
res = comp_emit_call ("Fsetcdr", comp.lisp_obj_type, 2, args);
PUSH_LVAL (res);
break;
case Bcar_safe:
error ("Bcar_safe not supported");
break;

View File

@ -233,6 +233,23 @@
(should (eq (comp-tests-geq-f 3 3) t))
(should (eq (comp-tests-geq-f 2 3) nil)))
(ert-deftest comp-tests-setcarcdr ()
"Testing setcar setcdr."
(defun comp-tests-setcar-f (x y)
(setcar x y)
x)
(defun comp-tests-setcdr-f (x y)
(setcdr x y)
x)
(byte-compile #'comp-tests-setcar-f)
(byte-compile #'comp-tests-setcdr-f)
(native-compile #'comp-tests-setcar-f)
(native-compile #'comp-tests-setcdr-f)
(should (equal (comp-tests-setcar-f '(10 . 10) 3) '(3 . 10)))
(should (equal (comp-tests-setcdr-f '(10 . 10) 3) '(10 . 3))))
(ert-deftest comp-tests-gc ()
"Try to do some longer computation to let the gc kick in."
(dotimes (_ 100000)