From 1510e15c3c709130ded1569fb1faee4e885c0ff8 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sun, 16 Jun 2019 15:32:29 +0200 Subject: [PATCH] Binsert support --- src/comp.c | 3 ++- test/src/comp-tests.el | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/comp.c b/src/comp.c index f19fc84479b..134d1baabcd 100644 --- a/src/comp.c +++ b/src/comp.c @@ -1945,7 +1945,8 @@ compile_f (const char *f_name, ptrdiff_t bytestr_length, break; case BinsertN: - error ("BinsertN not supported"); + op = FETCH; + EMIT_SCRATCH_CALL_N ("Finsert", op); break; case Bstack_set: diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index f1acc42b8ca..931b9e06094 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -314,12 +314,22 @@ (1+ (let ((a 1) (_b) (_c)) - a))) + a))) + (defun comp-tests-insertn-f (a b c d) + ;; Binsert + (insert a b c d)) (byte-compile #'comp-tests-discardn-f) (native-compile #'comp-tests-discardn-f) + (byte-compile #'comp-tests-insertn-f) + (native-compile #'comp-tests-insertn-f) - (should (= (comp-tests-discardn-f 10) 2))) + (should (= (comp-tests-discardn-f 10) 2)) + + (should (string= (with-temp-buffer + (comp-tests-insertn-f "a" "b" "c" "d") + (buffer-string)) + "abcd"))) (ert-deftest comp-tests-gc () "Try to do some longer computation to let the gc kick in." -- 2.39.5