branch: externals/phps-mode
commit b5a6f5986f22e9af8c560318aafbea35e8fd0d8c
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Added failing test and fix for bookkeeping namespaced trait function symbols
---
phps-mode-parser-sdt.el | 22 ++++++++++++----------
test/phps-mode-test-ast.el | 6 ++++++
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 26cca0d676..ee80957f95 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -984,8 +984,8 @@
imenu-nail
phps-mode-parser-sdt-symbol-imenu--table)))))))))
- (imenu-function
- (let ((imenu-nail2 (format "function %s" (nth 0
imenu-function))))
+ (imenu-trait
+ (let ((imenu-nail2 (format "trait %s" (nth 0 imenu-trait))))
(unless
(gethash
imenu-nail2
@@ -993,7 +993,7 @@
imenu-nail
phps-mode-parser-sdt-symbol-imenu--table))
(let ((imenu-object (make-hash-table :test 'equal)))
- (puthash 'declaration (nth 1 imenu-function)
imenu-object)
+ (puthash 'declaration (nth 1 imenu-trait) imenu-object)
(puthash
imenu-nail2
imenu-object
@@ -1021,8 +1021,8 @@
imenu-nail
phps-mode-parser-sdt-symbol-imenu--table)))))))))
- (imenu-trait
- (let ((imenu-nail2 (format "trait %s" (nth 0 imenu-trait))))
+ (imenu-interface
+ (let ((imenu-nail2 (format "interface %s" (nth 0
imenu-interface))))
(unless
(gethash
imenu-nail2
@@ -1030,7 +1030,7 @@
imenu-nail
phps-mode-parser-sdt-symbol-imenu--table))
(let ((imenu-object (make-hash-table :test 'equal)))
- (puthash 'declaration (nth 1 imenu-trait) imenu-object)
+ (puthash 'declaration (nth 1 imenu-interface)
imenu-object)
(puthash
imenu-nail2
imenu-object
@@ -1058,8 +1058,8 @@
imenu-nail
phps-mode-parser-sdt-symbol-imenu--table)))))))))
- (imenu-interface
- (let ((imenu-nail2 (format "interface %s" (nth 0
imenu-interface))))
+ (imenu-function
+ (let ((imenu-nail2 (format "function %s" (nth 0
imenu-function))))
(unless
(gethash
imenu-nail2
@@ -1067,7 +1067,7 @@
imenu-nail
phps-mode-parser-sdt-symbol-imenu--table))
(let ((imenu-object (make-hash-table :test 'equal)))
- (puthash 'declaration (nth 1 imenu-interface)
imenu-object)
+ (puthash 'declaration (nth 1 imenu-function)
imenu-object)
(puthash
imenu-nail2
imenu-object
@@ -1093,7 +1093,9 @@
imenu-nail2
(gethash
imenu-nail
-
phps-mode-parser-sdt-symbol-imenu--table))))))))))))
+ phps-mode-parser-sdt-symbol-imenu--table)))))))))
+
+ )))
(imenu-class
(let ((imenu-nail (format "class %s" (nth 0 imenu-class))))
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index b49b06df13..3564b392c9 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -396,6 +396,12 @@
'(((60 64) 1) ((82 86) 1))
'(("namespace myNamespace" ("declaration" . 18) ("function myFunction"
("declaration" . 41) ("function myFunction" ("declaration" . 41)) ("$var" .
60)))))
+ (phps-mode-test-ast--should-bookkeep
+ "<?php\n\nnamespace myNamespace;\n\ntrait myTrait\n{\n public function
myFunction($arg): string {\n if ($arg) {\n echo 'hit';\n
}\n }\n}"
+ "Bookkeeping of namespaced trait"
+ '(((79 83) 2) ((107 111) 2))
+ '(("namespace myNamespace" ("declaration" . 18) ("trait myTrait"
("declaration" . 38) ("function myFunction" ("declaration" . 68) ("$arg" .
79))))))
+
(message "\n-- Ran tests for bookkeeping generation. --"))
(defun phps-mode-test-ast ()