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

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

[elpa] externals/phps-mode f053587ff6 091/135: Passing another bookkeepi


From: Christian Johansson
Subject: [elpa] externals/phps-mode f053587ff6 091/135: Passing another bookkeeping test
Date: Sun, 29 Jan 2023 03:11:07 -0500 (EST)

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

    Passing another bookkeeping test
---
 phps-mode-parser-sdt.el    | 28 ++++++++++++++++++++++++----
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 5054cbacac..2db915af81 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2349,10 +2349,30 @@
                (setq symbol-scope (reverse symbol-scope))
                (setcar
                 (cdr symbol-list)
-                symbol-scope)
-               (push
-                (list symbol-name symbol-scope symbol-start symbol-end)
-                phps-mode-parser-sdt--bookkeeping-symbol-stack)))))))
+                symbol-scope))))))
+
+     (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+       (dolist (
+                symbol-list
+                phps-mode-parser-sdt--bookkeeping-symbol-stack)
+         (let ((symbol-name (car symbol-list))
+               (symbol-start (nth 2 symbol-list))
+               (symbol-end (nth 3 symbol-list)))
+           (unless (gethash
+                    symbol-name
+                    phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+             (let ((symbol-scope (reverse (car (cdr symbol-list)))))
+               (if (equal (car (car symbol-scope)) 'namespace)
+                   (let ((namespace-name (car (cdr (car symbol-scope)))))
+                     (setcar symbol-scope (list 'interface class-name))
+                     (push (list 'namespace namespace-name) symbol-scope))
+                 (push
+                  (list 'interface class-name)
+                  symbol-scope))
+               (setq symbol-scope (reverse symbol-scope))
+               (setcar
+                (cdr symbol-list)
+                symbol-scope)))))))
 
    `(
      ast-type
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index f5c1c25482..3eb4679195 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -346,7 +346,7 @@
   (phps-mode-test-ast--should-bookkeep
    "<?php\nclass There\n{\n    private $variable;\n    private \\My\\Random 
$variable2;\n    private string $variable3;\n    private static $variable4;\n   
 private static \\My\\Random $variable5;\n    private static string 
$variable6;\n    function here()\n    {\n        if ($this->variable) {}\n      
  if ($this->variable2) {}\n        if ($this->variable3) {}\n        if 
($this->variable4) {}\n        if (self::$variable4) {}\n        if 
(self::$variable5) {}\n        if (self::$varia [...]
    "Bookkeeping of typed class variables"
-   '((" class There function here id $this" ((245 482))) (" class There static 
id $variable6" ((209 219))) (" class There static id $variable5" ((171 181))) 
(" class There static id $variable4" ((129 139))) (" class There id $variable3" 
((98 108))) (" class There id $variable2" ((67 77))) (" class There id 
$variable" ((33 42))) ((462 472) 1) ((429 439) 1) ((396 406) 1) ((364 373) 0) 
((357 362) 1) ((331 340) 1) ((324 329) 1) ((298 307) 1) ((291 296) 1) ((266 
274) 1) ((259 264) 1)))
+   '((" class There function here id $this" ((245 482))) (" class There static 
id $variable6" ((209 219))) (" class There static id $variable5" ((171 181))) 
(" class There static id $variable4" ((129 139))) (" class There id $variable3" 
((98 108))) (" class There id $variable2" ((67 77))) (" class There id 
$variable" ((33 42))) ((462 472) 1) ((429 439) 1) ((396 406) 1) ((364 373) 0) 
((357 362) 1) ((331 340) 1) ((324 329) 1) ((298 307) 1) ((291 296) 1) ((266 
274) 1) ((259 264) 1) ((209 21 [...]
 
   (phps-mode-test-ast--should-bookkeep
    "<?php\n\n$a = $b = $c = 3;\n\nif ($a) {\n    echo 'a=',$a;\n} else {\n    
echo '$a is undefined!';\n}\nif ($b) {\n    echo 'b=',$b;\n} else {\n    echo 
'$b is undefined!';\n}\nif ($c) {\n    echo 'c=',$c;\n} else {\n    echo '$c is 
undefined!';\n}"



reply via email to

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