From 2ff9919e44fdb58b7e89c15256dc7c6686f0d207 Mon Sep 17 00:00:00 2001 From: Hugo Thunnissen Date: Mon, 14 Aug 2023 19:40:15 +0200 Subject: [PATCH] Add debug statements + use condition-case-unless-debug for token indexation --- phpinspect-index.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/phpinspect-index.el b/phpinspect-index.el index 88e43ba..6c76a52 100644 --- a/phpinspect-index.el +++ b/phpinspect-index.el @@ -66,12 +66,15 @@ of TYPE, if available." If ADD-USED-TYPES is set, it must be a function and will be called with a list of the types that are used within the function (think \"new\" statements, return types etc.)." + (phpinspect--log "Indexing function") (let* ((php-func (cadr scope)) (declaration (cadr php-func)) (type (if (phpinspect-word-p (car (last declaration))) (funcall type-resolver (phpinspect--make-type :name (cadar (last declaration))))))) + (phpinspect--log "Checking function return annotations") + ;; @return annotation. When dealing with a collection, we want to store the ;; type of its members. (let* ((return-annotation-type @@ -107,6 +110,7 @@ function (think \"new\" statements, return types etc.)." (when type (push (phpinspect--type-bare-name type) used-types)) (funcall add-used-types used-types))) + (phpinspect--log "Creating function object") (phpinspect--make-function :scope `(,(car scope)) :token php-func @@ -492,7 +496,7 @@ Return value is a list of the types that are \"newed\"." (defun phpinspect--index-tokens (tokens &optional type-resolver-factory location-resolver) "Index TOKENS as returned by `phpinspect--parse-current-buffer`." (or - (condition-case err + (condition-case-unless-debug err (progn (unless type-resolver-factory (setq type-resolver-factory #'phpinspect--make-type-resolver)) @@ -523,9 +527,6 @@ Return value is a list of the types that are \"newed\"." tokens type-resolver-factory imports)))))) (t (phpinspect--log "phpinspect--index-tokens failed: %s. Enable debug-on-error for backtrace." err) - (when (or debug-on-error phpinspect--debug) - (require 'backtrace) - (backtrace)) nil)) '(phpinspect--root-index)))