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

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

[elpa] externals/phps-mode 7284fe51ca 2/3: Parser SDT handles abstract c


From: Christian Johansson
Subject: [elpa] externals/phps-mode 7284fe51ca 2/3: Parser SDT handles abstract class methods
Date: Thu, 23 Feb 2023 16:08:59 -0500 (EST)

branch: externals/phps-mode
commit 7284fe51ca38c2108d959fc4c11aa8f5393c28b1
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Parser SDT handles abstract class methods
---
 phps-mode-parser-sdt.el    |  4 +++-
 test/phps-mode-test-ast.el | 14 +++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index fad3ca1b64..376a52bfdf 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -3116,7 +3116,9 @@
                       (item-end (nth 3 item)))
                  (when (and
                         (>= item-start class-start)
-                        (<= item-end class-end))
+                        (or
+                         (not item-end)
+                         (<= item-end class-end)))
                    (push
                     (list 'class class-name class-start class-end)
                     (nth imenu-stack-index 
phps-mode-parser-sdt-symbol-imenu--stack))
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 6c8615f703..9ae41ab542 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -130,13 +130,6 @@
   "Run test for bookkeeping generation."
   (message "-- Running tests for bookkeeping generation... --\n")
 
-  ;; TODO Make this test pass
-  (phps-mode-test-ast--should-bookkeep
-   "<?php\nabstract class AbstractClass\n{\n    // Force Extending class to 
define this method\n    abstract protected function getValue();\n    abstract 
protected function prefixValue($prefix);\n\n    // Common method\n    public 
function printOut() {\n        print $this->getValue() . \"\\n\";\n    
}\n}\n\nclass ConcreteClass1 extends AbstractClass\n{\n    protected function 
getValue() {\n        return \"ConcreteClass1\";\n    }\n\n    public function 
prefixValue($prefix) {\n        r [...]
-   "Bookkeeping of abstract class"
-   '((0 1))
-   '((a b)))
-
   ;; TODO v1 Symbol namespace should be class | interface | trait / symbol
   ;; TODO v2 Should have more delicate handling of isset, !empty condition 
blocks
   ;; TODO v2 Should properly bookkeep inside potentially endlessly nested 
anonymous functions / arrow functions / anonymous classes
@@ -393,6 +386,13 @@
    '(((35 39) 1) ((105 109) 1) ((165 170) 0) ((221 226) 2))
    '(("class myClass" ("declaration" . 14) ("$abc" . 35) ("function 
__construct" ("declaration" . 67)))))
 
+
+  (phps-mode-test-ast--should-bookkeep
+   "<?php\nabstract class AbstractClass\n{\n    // Force Extending class to 
define this method\n    abstract protected function getValue();\n    abstract 
protected function prefixValue($prefix);\n\n    // Common method\n    public 
function printOut() {\n        print $this->getValue() . \"\\n\";\n    
}\n}\n\nclass ConcreteClass1 extends AbstractClass\n{\n    protected function 
getValue() {\n        return \"ConcreteClass1\";\n    }\n\n    public function 
prefixValue($prefix) {\n        r [...]
+   "Bookkeeping of abstract class"
+   '(((177 184) 1) ((256 261) 2) ((444 451) 5) ((472 479) 5) ((656 663) 8) 
((684 691) 8) ((718 725) 9) ((748 755) 9) ((774 781) 9) ((811 818) 10) ((841 
848) 10) ((867 874) 10))
+   '(("class AbstractClass" ("declaration" . 22) ("function getValue" 
("declaration" . 121)) ("function prefixValue" ("declaration" . 165) ("$prefix" 
. 177)) ("function printOut" ("declaration" . 229))) ("class ConcreteClass1" 
("declaration" . 297) ("function getValue" ("declaration" . 359)) ("function 
prefixValue" ("declaration" . 432) ("$prefix" . 444))) ("class ConcreteClass2" 
("declaration" . 512) ("function getValue" ("declaration" . 571)) ("function 
prefixValue" ("declaration" . 64 [...]
+
   (message "\n-- Ran tests for bookkeeping generation. --"))
 
 (defun phps-mode-test-ast ()



reply via email to

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