Function: testcover-analyze-coverage-wrapped-form
testcover-analyze-coverage-wrapped-form is a byte-compiled function
defined in testcover.el.gz.
Signature
(testcover-analyze-coverage-wrapped-form FORM)
Documentation
Analyze a FORM for code coverage which was wrapped by edebug-after.
FORM is treated as if it will be evaluated.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/testcover.el.gz
(defun testcover-analyze-coverage-wrapped-form (form)
"Analyze a FORM for code coverage which was wrapped by `edebug-after'.
FORM is treated as if it will be evaluated."
(pcase form
((pred keywordp)
'testcover-1value)
((pred symbolp)
(when (or (memq form testcover-constants)
(memq form testcover-module-constants))
'testcover-1value))
((pred atom)
'testcover-1value)
(`(\` ,bq-form)
(testcover-analyze-coverage-backquote-form bq-form))
(`(defconst ,sym ,val . ,_)
(push sym testcover-module-constants)
(testcover-analyze-coverage val)
'testcover-1value)
(`(,(or 'dotimes 'dolist) (,_ ,expr . ,result) . ,body)
;; These always return RESULT if provided.
(testcover-analyze-coverage expr)
(testcover-analyze-coverage-progn body)
(let ((val (testcover-analyze-coverage-progn result)))
;; If the third value is not present, the loop always returns nil.
(if result val 'testcover-1value)))
(`(,(or 'let 'let*) ,bindings . ,body)
(testcover-analyze-coverage-progn bindings)
(testcover-analyze-coverage-progn body))
(`(if ,test ,then-form . ,else-body)
;; `if' is potentially 1-valued if both THEN and ELSE clauses are.
(testcover-analyze-coverage test)
(let ((then (testcover-analyze-coverage then-form))
(else (testcover-analyze-coverage else-body)))
(and then else 'maybe)))
(`(cond . ,clauses)
;; `cond' is potentially 1-valued if all clauses are.
(when (testcover-analyze-coverage-compose clauses #'testcover-analyze-coverage-progn)
'maybe))
(`(condition-case ,_ ,body-form . ,handlers)
;; `condition-case' is potentially 1-valued if BODY-FORM is and all
;; HANDLERS are.
(let ((body (testcover-analyze-coverage body-form))
(errs (testcover-analyze-coverage-compose
(mapcar #'cdr handlers)
#'testcover-analyze-coverage-progn)))
(and body errs 'maybe)))
(`(apply (quote ,(and func (pred symbolp))) . ,args)
;; Process application of a constant symbol as 1value or noreturn
;; depending on the symbol.
(let ((temp-form (cons func args)))
(testcover-analyze-coverage-wrapped-form temp-form)))
(`(,(and func (or '1value 'noreturn)) ,inner-form)
;; 1value and noreturn change how the edebug-after they wrap is handled.
(let ((val (if (eq func '1value) '1value 'maybe)))
(pcase inner-form
(`(edebug-after ,(and before-form
(or `(edebug-before ,before-id) before-id))
,after-id ,wrapped-form)
(testcover-analyze-coverage-edebug-after inner-form before-form
before-id after-id
wrapped-form func))
(_ (testcover-analyze-coverage inner-form)))
val))
(`(,func . ,args)
(testcover-analyze-coverage-wrapped-application func args))))