[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#25316: Patch for bug#25316: 26.0.50; Bugs in testcover-reinstrument
From: |
Noam Postavsky |
Subject: |
bug#25316: Patch for bug#25316: 26.0.50; Bugs in testcover-reinstrument |
Date: |
Sat, 30 Sep 2017 10:40:09 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) |
Gemini Lasswell <gazally@runbox.com> writes:
> (edebug-enter): New function which changes behavior of Edebug based
> on symbol property 'edebug-behavior and edebug-behavior-alist.
Those should be wrapped in quotes as in `edebug-behavior' and
`edebug-behavior-alist'.
> -(defun edebug-enter (function args body)
> +(defun edebug-enter (func args body)
> + "Enter Edebug for a function.
> +FUNC should be the symbol with the Edebug information, ARGS is
> +the list of arguments and BODY is the code.
> +
> +Look up the `edebug-behavior' for FUNC in `edebug-behavior-alist'
> +and run its entry function, and set up `edebug-before' and
> +`edebug-after'."
> + (cl-letf* ((behavior (get func 'edebug-behavior))
> + (functions (cdr (assoc behavior edebug-behavior-alist)))
> + ((symbol-function #'edebug-before) (nth 1 functions))
> + ((symbol-function #'edebug-after) (nth 2 functions)))
> + (funcall (nth 0 functions) func args body)))
Overriding the function-definition of edebug-before and edebug-after
doesn't seem very clean. It would be better to have an
edebug-before-function which is `funcall'ed I think (I know your patch
didn't introduce this, it just makes it more obvious. Perhaps it could
be addressed later).
> (defun edebug-run-slow ()
> - (defalias 'edebug-before 'edebug-slow-before)
> - (defalias 'edebug-after 'edebug-slow-after))
> + "Set up Edebug's normal behavior."
> + (setf (cdr (assq 'edebug edebug-behavior-alist))
> + '(edebug-default-enter edebug-slow-before edebug-slow-after)))
> +(defun testcover-analyze-coverage (form)
> + (pcase form
> + (`(quote . ,_)
> + ;; A quoted form is 1value. Edebug could have instrumented
> + ;; something inside the form if an Edebug spec contained a quote.
> + ;; It's also possible that the quoted form is a circular object.
> + ;; To avoid infinite recursion, don't examine quoted objects.
> + ;; This will cause the coverage marks on an instrumented quoted
> + ;; form to look odd. See bug#25316.
> + '1value)
Missed double spacing again.
> + ((or `(\` ,bq-form) `(\` . ,bq-form))
Isn't only the first of these is needed? (read "`foo") ;=> (\` foo)
> +(defun testcover-analyze-coverage-wrapped-form (form)
> + (pcase form
> + ((or `(\` ,bq-form) `(\` . ,bq-form))
As above.