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. ...@@ -258,6 +258,9 @@ The return value is undefined.
(cons 'prog1 (cons def declarations)) (cons 'prog1 (cons def declarations))
def)))))) def))))))
(defvar defun-last-function-name nil
"Last function name macroexpanded by `defun'.")
;; Now that we defined defmacro we can use it! ;; Now that we defined defmacro we can use it!
(defmacro defun (name arglist &optional docstring &rest body) (defmacro defun (name arglist &optional docstring &rest body)
"Define NAME as a function. "Define NAME as a function.
...@@ -280,6 +283,7 @@ The return value is undefined. ...@@ -280,6 +283,7 @@ The return value is undefined.
(and (listp arglist) (and (listp arglist)
(null (delq t (mapcar #'symbolp arglist))))) (null (delq t (mapcar #'symbolp arglist)))))
(error "Malformed arglist: %s" arglist)) (error "Malformed arglist: %s" arglist))
(setq defun-last-function-name name)
(let ((decls (cond (let ((decls (cond
((eq (car-safe docstring) 'declare) ((eq (car-safe docstring) 'declare)
(prog1 (cdr docstring) (setq docstring nil))) (prog1 (cdr docstring) (setq docstring nil)))
......
...@@ -2374,10 +2374,13 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C). ...@@ -2374,10 +2374,13 @@ values. For compatibility, (cl-values A B C) is a synonym for (list A B C).
'((0 nil) (1 t) (2 t) (3 t)))) '((0 nil) (1 t) (2 t) (3 t))))
(safety (assq (nth 1 (assq 'safety (cdr spec))) (safety (assq (nth 1 (assq 'safety (cdr spec)))
'((0 t) (1 t) (2 t) (3 nil))))) '((0 t) (1 t) (2 t) (3 nil)))))
(if speed (setq cl--optimize-speed (car speed) (when speed
byte-optimize (nth 1 speed))) (setq cl--optimize-speed (car speed)
(if safety (setq cl--optimize-safety (car safety) byte-optimize (nth 1 speed))
byte-compile-delete-errors (nth 1 safety))))) (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)) ((and (eq (car-safe spec) 'warn) (boundp 'byte-compile-warnings))
(while (setq spec (cdr spec)) (while (setq spec (cdr spec))
......
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