branch: externals/phpinspect commit 30500e77fd0d2bac25237b8d9f1c65fa35de00cc Author: Hugo Thunnissen <de...@hugot.nl> Commit: Hugo Thunnissen <de...@hugot.nl>
Only use no-enqueue when it is necessary Needs further investigation, but sometimes using no-enqueue can result in a deadlock. A likely cause is the use of no-enqueue while calling the function from the main-thread. --- phpinspect-resolve.el | 13 +++++++++---- phpinspect-resolvecontext.el | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/phpinspect-resolve.el b/phpinspect-resolve.el index 2dfde7399f..5c9e0c5ae8 100644 --- a/phpinspect-resolve.el +++ b/phpinspect-resolve.el @@ -162,7 +162,7 @@ Destructively removes tokens from the end of ASSIGNMENT-TOKENS." (phpi-typedef-get-methods class))))) (defsubst phpinspect-get-cached-project-typedef-method-type (rctx class-fqn method-name) - (let* ((class (phpinspect-rctx-get-typedef rctx class-fqn)) + (let* ((class (phpinspect-rctx-get-typedef rctx class-fqn 'no-enqueue)) (method)) (when class (setq method @@ -176,14 +176,14 @@ Destructively removes tokens from the end of ASSIGNMENT-TOKENS." class-fqn variable-name) (let ((found-variable (phpi-typedef-get-property - (phpinspect-rctx-get-typedef rctx class-fqn) + (phpinspect-rctx-get-typedef rctx class-fqn 'no-enqueue) variable-name))) (when found-variable (phpi-var-type found-variable)))) (defsubst phpinspect-get-cached-project-typedef-static-method-type (rctx class-fqn method-name) - (let* ((class (phpinspect-rctx-get-typedef rctx class-fqn)) + (let* ((class (phpinspect-rctx-get-typedef rctx class-fqn 'no-enqueue)) (method)) (when class (setq method @@ -247,7 +247,12 @@ value/type of ->bar must be derived from the type of $foo. So (phpinspect--log "Starting attribute type: %s" type-before) (while-let ((current-token (pop statement))) (phpinspect--log "Current derived statement token: %s" current-token) - (cond ((phpinspect-object-attrib-p current-token) + (cond ((not type-before) + ;; No type-before means there is no point in trying to derive + ;; anything any longer (can't derive from nil). Set statement to + ;; nil to end loop. + (setq statement nil)) + ((phpinspect-object-attrib-p current-token) (let ((attribute-word (cadr current-token))) (when (phpinspect-word-p attribute-word) (if (phpinspect-list-p (car statement)) diff --git a/phpinspect-resolvecontext.el b/phpinspect-resolvecontext.el index e480f400f4..fc3ade61df 100644 --- a/phpinspect-resolvecontext.el +++ b/phpinspect-resolvecontext.el @@ -219,10 +219,10 @@ accompanied by all of its enclosing tokens." resolvecontext))) -(defun phpinspect-rctx-get-typedef (rctx class-fqn &optional _ignored) +(defun phpinspect-rctx-get-typedef (rctx class-fqn &optional no-enqueue) (cl-assert (phpinspect--resolvecontext-p rctx)) (let ((project (phpinspect--resolvecontext-project rctx))) - (phpinspect-project-get-typedef-extra-or-create project class-fqn 'no-enqueue))) + (phpinspect-project-get-typedef-extra-or-create project class-fqn no-enqueue))) (defun phpinspect-rctx-get-function-return-type (rctx function-name) (cl-assert (phpinspect--resolvecontext-p rctx))