[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode ae516f9e19 105/135: Using separate imenu item
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode ae516f9e19 105/135: Using separate imenu items for redeclared symbols |
Date: |
Sun, 29 Jan 2023 03:11:09 -0500 (EST) |
branch: externals/phps-mode
commit ae516f9e19521ef4fb5bcc1657ef7ee75b19bcc3
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Using separate imenu items for redeclared symbols
---
phps-mode-parser-sdt.el | 13 ++++++++++---
test/phps-mode-test-ast.el | 6 +++---
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 2e72e4b18a..fc4c5fefe6 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -647,6 +647,8 @@
name
phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
name
+ ;; TODO Should capture unique scopes (without the id)
+ ;; with name and place on the imenu list
(let ((potential-uris (list "")))
(when scope
(let ((scope-count (length scope))
@@ -857,9 +859,14 @@
;; and place a reference to it in the symbol URI hash-map
(if (gethash symbol-uri phps-mode-parser-sdt-symbol-table-by-uri)
(progn
- (push
- `(,symbol-uri . ,symbol-start)
- phps-mode-parser-sdt-symbol-imenu)
+ (let ((symbol-uri-duplicate
+ (format
+ "%s (%d)"
+ symbol-uri
+ (1+ (length (gethash symbol-uri
phps-mode-parser-sdt-symbol-table-by-uri))))))
+ (push
+ `(,symbol-uri-duplicate . ,symbol-start)
+ phps-mode-parser-sdt-symbol-imenu))
(puthash
phps-mode-parser-sdt-symbol-table-index
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 65ebb01de2..94604729d1 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -256,7 +256,7 @@
"<?php\nif (isset($b)) {\n $b = false;\n}\n$c = 2;\n\nif ($c) {\n
echo 'Hit';\n}\n"
"Bookkeeping of variable after isset() block"
'(((28 30) 1) ((17 19) 0) ((42 44) 3) ((55 57) 3))
- '(("id $b" . 28) ("id $b" . 17)("id $c" . 42)))
+ '(("id $b" . 28) ("id $b (2)" . 17) ("id $c" . 42)))
(phps-mode-test-ast--should-bookkeep
"<?php\nif (!isset($a)) {\n if ($a) {\n echo 'Miss';\n }\n}"
@@ -268,7 +268,7 @@
"<?php\n\nfunction myFunction($a, $b, $c, $d)\n{\n global $f, $g;\n
if (isset($f)) {\n if (!empty($g)) {\n if ($a) {\n
echo 'Hit';\n }\n if ($b) {\n echo
'Hit';\n }\n if ($c) {\n echo 'Hit';\n
}\n if ($d) {\n echo 'Hit';\n }\n
}\n }\n}\n"
"Bookkeeping variables inside nested isset() !empty() blocks"
'(((40 42) 1) ((36 38) 2) ((32 34) 3) ((28 30) 4) ((320 322) 1) ((256 258)
2) ((192 194) 3) ((128 130) 4) ((105 107) 5) ((79 81) 6) ((61 63) 0) ((57 59)
0))
- '(("function myFunction id $d" . 40) ("function myFunction id $c" . 36)
("function myFunction id $b" . 32) ("function myFunction id $a" . 28)
("function myFunction id $g" . 105) ("function myFunction id $f" . 79)
("function myFunction id $g" . 61) ("function myFunction id $f" . 57)))
+ '(("function myFunction id $d" . 40) ("function myFunction id $c" . 36)
("function myFunction id $b" . 32) ("function myFunction id $a" . 28)
("function myFunction id $g" . 105) ("function myFunction id $f" . 79)
("function myFunction id $g (2)" . 61) ("function myFunction id $f (2)" . 57)))
(phps-mode-test-ast--should-bookkeep
"<?php\n\n$var = 123;\n\nfunction test($abc) {\n static $var;\n if
($var) {\n echo 'Hit';\n }\n}"
@@ -328,7 +328,7 @@
"<?php\nnamespace myNamespace;\nclass myClass\n{\n private $property1 =
'';\n private $property2;\n protected function myMethod(\n
$argument1,\n $argument2,\n $argument3\n ) {\n if
($this->property2) {\n echo 'was here';\n }\n /*
@codingStandardsIgnoreEnd */\n if (\n $argument1\n
&& $argument2\n && $argument3\n && $argument4\n
&& !empty($argument1['index'])\n [...]
"Bookkeeping of properties inside if condition list"
'(((180 190) 1) ((160 170) 2) ((140 150) 3) ((544 553) 7) ((537 542) 4)
((514 524) 3) ((489 498) 7) ((482 487) 4) ((446 456) 3) ((413 423) 0) ((387
397) 1) ((361 371) 2) ((335 345) 3) ((218 227) 6) ((211 216) 4) ((87 97) 6)
((58 68) 7))
- '(("namespace myNamespace class myClass function myMethod id $argument3" .
180) ("namespace myNamespace class myClass function myMethod id $argument2" .
160) ("namespace myNamespace class myClass function myMethod id $argument1" .
140) ("namespace myNamespace class myClass function myMethod id $this" . 197)
("namespace myNamespace class myClass function myMethod id $argument1" . 446)
("namespace myNamespace class myClass id $property2" . 87) ("namespace
myNamespace class myClass id $pr [...]
+ '(("namespace myNamespace class myClass function myMethod id $argument3" .
180) ("namespace myNamespace class myClass function myMethod id $argument2" .
160) ("namespace myNamespace class myClass function myMethod id $argument1" .
140) ("namespace myNamespace class myClass function myMethod id $this" . 197)
("namespace myNamespace class myClass function myMethod id $argument1 (2)" .
446) ("namespace myNamespace class myClass id $property2" . 87) ("namespace
myNamespace class myClass id [...]
(phps-mode-test-ast--should-bookkeep
"<?php\ntrait MyTrait {\n private $var = 'abc';\n public function
sayHello() {\n if ($this->var) {\n echo 'Hit';\n }\n
}\n}\n"
- [elpa] externals/phps-mode eac10d63e6 063/135: Started on bookkeeping of variables inside anonymous functions, (continued)
- [elpa] externals/phps-mode eac10d63e6 063/135: Started on bookkeeping of variables inside anonymous functions, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode e924ac83b6 065/135: Improved bookkeeping test for anonymous function, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode e614a20ada 066/135: Added bookkeeping for referenced foreach variables, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode d33625bb1a 067/135: Bookkeeping for array assignment passing test, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode a646676781 084/135: Passing more bookkeeping tests, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 7609f09f04 090/135: More bookkeeping final touches, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 6c6906317a 095/135: Added bookkeeping test for trait class symbols, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode ada5e79291 097/135: Passing bookkeeping test for class properties in class constructor, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 8aae220c57 098/135: Started on integrating imenu generation in SDT bookkeeping, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 95f563fc70 102/135: Passing bookkeeping tests with integrated imenu generation, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode ae516f9e19 105/135: Using separate imenu items for redeclared symbols,
Christian Johansson <=
- [elpa] externals/phps-mode b21c9f3f3a 107/135: Imenu generation via SDT all tests now passing, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 3332b2bfa9 109/135: Fixes syntax coloring of super-globals, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode bddf800099 111/135: Added failing test, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode d98f6d78d8 114/135: Saving symbol-table after parse, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 1594c15e9e 117/135: More work on imenu generation, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 776c818ff9 121/135: Passing some more imenu tests, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode c6e4844753 122/135: Some byte-compilation fixes, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 96eeff74f8 130/135: Added more todo items for bookkeeping and imenu, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 66ad034207 025/135: SDT member_modifier, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 34a595fa09 028/135: SDT class_const_list, Christian Johansson, 2023/01/29