emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phpinspect f9f12590e8 6/8: Handle cases where declarati


From: ELPA Syncer
Subject: [elpa] externals/phpinspect f9f12590e8 6/8: Handle cases where declarations do not contain a name
Date: Mon, 14 Aug 2023 15:58:29 -0400 (EDT)

branch: externals/phpinspect
commit f9f12590e8c106dd804d96bee9926c4dd84b0051
Author: Hugo Thunnissen <devel@hugot.nl>
Commit: Hugo Thunnissen <devel@hugot.nl>

    Handle cases where declarations do not contain a name
---
 phpinspect-project.el | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/phpinspect-project.el b/phpinspect-project.el
index 0eb3ac8ce8..6f8b228fff 100644
--- a/phpinspect-project.el
+++ b/phpinspect-project.el
@@ -189,20 +189,23 @@ indexed by the absolute paths of the files they're 
watching."))
 
 (cl-defmethod phpinspect-project-add-class
   ((project phpinspect-project) (indexed-class (head 
phpinspect--indexed-class)) &optional index-imports)
-  (let* ((class-name (phpinspect--type-name-symbol
-                      (alist-get 'class-name (cdr indexed-class))))
-         (class (gethash class-name
-                         (phpinspect-project-class-index project))))
-    (unless class
-      (setq class (phpinspect--make-class-generated :project project)))
-
-    (when index-imports
-      (phpinspect-project-enqueue-imports
-       project (alist-get 'imports (cdr indexed-class))))
-
-    (phpinspect--class-set-index class indexed-class)
-    (puthash class-name class (phpinspect-project-class-index project))
-    (phpinspect-project-add-class-attribute-types-to-index-queue project 
class)))
+  (if (not (alist-get 'class-name (cdr indexed-class)))
+      (phpinspect--log "Error: Class with declaration %s does not have a name" 
(alist-get 'declaration indexed-class))
+    ;; Else
+    (let* ((class-name (phpinspect--type-name-symbol
+                        (alist-get 'class-name (cdr indexed-class))))
+           (class (gethash class-name
+                           (phpinspect-project-class-index project))))
+      (unless class
+        (setq class (phpinspect--make-class-generated :project project)))
+
+      (when index-imports
+        (phpinspect-project-enqueue-imports
+         project (alist-get 'imports (cdr indexed-class))))
+
+      (phpinspect--class-set-index class indexed-class)
+      (puthash class-name class (phpinspect-project-class-index project))
+      (phpinspect-project-add-class-attribute-types-to-index-queue project 
class))))
 
 (cl-defmethod phpinspect-project-set-class
   ((project phpinspect-project) (class-fqn phpinspect--type) (class 
phpinspect--class))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]