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

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

[elpa] externals/phps-mode bb381d8127 041/212: Bookkeeping of class prop


From: Christian Johansson
Subject: [elpa] externals/phps-mode bb381d8127 041/212: Bookkeeping of class properties via AST passed test
Date: Wed, 26 Jan 2022 01:50:34 -0500 (EST)

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

    Bookkeeping of class properties via AST passed test
---
 phps-mode-ast-bookkeeping.el | 6 ++++++
 phps-mode-parser-sdt.el      | 8 ++++++--
 test/phps-mode-test-ast.el   | 2 +-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index 7daf64317b..fc20aea951 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -563,6 +563,12 @@
               (cond
 
                ((string= downcase-subject-name "$this")
+                (puthash
+                 (list
+                  (plist-get subject 'start)
+                  (plist-get subject 'end))
+                 1
+                 bookkeeping)
                 (let* ((sub-variable-namespace
                         (phps-mode-ast-bookkeeping--generate-variable-namespace
                          namespace
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 060e337288..7d883851d4 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -619,7 +619,7 @@
 ;; static_member -> (class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable)
 (puthash
  495
- (lambda(args _terminals)
+ (lambda(args terminals)
    (let ((ast-object
           (list
            'ast-type
@@ -627,7 +627,11 @@
            'class
            (nth 0 args)
            'member
-           (nth 2 args))))
+           (nth 2 args)
+           'start
+           (car (cdr (nth 0 terminals)))
+           'end
+           (cdr (cdr (nth 0 terminals))))))
      ast-object))
  phps-mode-parser--table-translations)
 
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index ba863c74cf..6ad813295e 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -378,7 +378,7 @@
      (phps-mode-ast-bookkeeping--generate)
      (should (equal
               (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
-              '((" class myParent id $var1" 1) ((93 98) 1) (" class myParent 
static id $var2" 1) ((127 132) 1) (" class myParent id $var3" 1) ((145 150) 1) 
(" class myParent id $var4" 1) ((160 165) 1) (" class myParent function 
__construct id $this" 1) ((208 213) 1) ((263 268) 1) ((270 274) 1) ((330 335) 
0) ((392 397) 1) ((447 452) 1) ((454 458) 1) ((508 513) 1) ((515 519) 1) ((569 
574) 1) ((576 580) 0) ((688 693) 0))))))
+              '((" class myClass id $var1" 1) ((93 98) 1) (" class myClass 
static id $var2" 1) ((127 132) 1) (" class myClass id $var3" 1) ((145 150) 1) 
(" class myClass id $var4" 1) ((160 165) 1) (" class myClass function 
__construct id $this" 1) ((208 213) 1) ((263 268) 1) ((270 274) 1) ((330 335) 
0) ((392 397) 1) ((447 452) 1) ((454 458) 1) ((508 513) 1) ((515 519) 1) ((569 
574) 1) ((576 580) 0) ((688 693) 0))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\n\ntry {\n    \n} catch (\\Exception $e) {\n    if ($e) {\n        
echo 'Hit';\n    }\n}\n\nif ($e) {\n    echo 'Miss';\n}\n"



reply via email to

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