Commit 612df640 authored by Andrea Corallo's avatar Andrea Corallo

Have cl-declare set function speed prop

parent c3ddcf73
Pipeline #6712 failed with stage
in 83 minutes and 1 second
......@@ -258,6 +258,9 @@ The return value is undefined.
(cons 'prog1 (cons def declarations))
(defvar defun-last-function-name nil
"Last function name macroexpanded by `defun'.")
;; Now that we defined defmacro we can use it!
(defmacro defun (name arglist &optional docstring &rest body)
"Define NAME as a function.
......@@ -280,6 +283,7 @@ The return value is undefined.
(and (listp arglist)
(null (delq t (mapcar #'symbolp arglist)))))
(error "Malformed arglist: %s" arglist))
(setq defun-last-function-name name)
(let ((decls (cond
((eq (car-safe docstring) 'declare)
(prog1 (cdr docstring) (setq docstring nil)))
......@@ -2374,9 +2374,12 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C).
'((0 nil) (1 t) (2 t) (3 t))))
(safety (assq (nth 1 (assq 'safety (cdr spec)))
'((0 t) (1 t) (2 t) (3 nil)))))
(if speed (setq cl--optimize-speed (car speed)
byte-optimize (nth 1 speed)))
(if safety (setq cl--optimize-safety (car safety)
(when speed
(setq cl--optimize-speed (car speed)
byte-optimize (nth 1 speed))
(function-put defun-last-function-name 'speed cl--optimize-speed))
(when safety
(setq cl--optimize-safety (car safety)
byte-compile-delete-errors (nth 1 safety)))))
((and (eq (car-safe spec) 'warn) (boundp 'byte-compile-warnings))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment