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

Bcar_safe Bcdr_safe support

This commit is contained in:
Andrea Corallo 2019-06-16 15:59:41 +02:00 committed by Andrea Corallo
parent eefd7d819c
commit bb45450e4b
2 changed files with 22 additions and 4 deletions

View File

@ -1863,10 +1863,15 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length,
CASE_CALL_NARGS (setcdr, 2);
case Bcar_safe:
error ("Bcar_safe not supported");
POP2;
res = emit_call ("CAR_SAFE", comp.lisp_obj_type, 1, args);
PUSH_RVAL (res);
break;
case Bcdr_safe:
error ("Bcdr_safe not supported");
POP2;
res = emit_call ("CDR_SAFE", comp.lisp_obj_type, 1, args);
PUSH_RVAL (res);
break;
case Bnconc:
@ -2189,7 +2194,6 @@ Lisp_Object helper_unbind_n (int val);
bool helper_PSEUDOVECTOR_TYPEP_XUNTAG (const union vectorlike_header *a,
enum pvec_type code);
Lisp_Object
helper_save_window_excursion (Lisp_Object v1)
{

View File

@ -45,11 +45,25 @@
"Testing cons car cdr."
(defun comp-tests-list-f ()
(list 1 2 3))
(defun comp-tests-car-safe-f (x)
;; Bcar_safe
(car-safe x))
(defun comp-tests-cdr-safe-f (x)
;; Bcdr_safe
(cdr-safe x))
(byte-compile #'comp-tests-list-f)
(native-compile #'comp-tests-list-f)
(byte-compile #'comp-tests-car-safe-f)
(native-compile #'comp-tests-car-safe-f)
(byte-compile #'comp-tests-cdr-safe-f)
(native-compile #'comp-tests-cdr-safe-f)
(should (equal (comp-tests-list-f) '(1 2 3))))
(should (equal (comp-tests-list-f) '(1 2 3)))
(should (= (comp-tests-car-safe-f '(1 . 2)) 1))
(should (null (comp-tests-car-safe-f 'a)))
(should (= (comp-tests-cdr-safe-f '(1 . 2)) 2))
(should (null (comp-tests-cdr-safe-f 'a))))
(ert-deftest comp-tests-cons-car-cdr ()
"Testing cons car cdr."