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

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

[elpa] externals/phps-mode 65c3c7eedc 1/4: Fixed bookkeeping of multiple


From: Christian Johansson
Subject: [elpa] externals/phps-mode 65c3c7eedc 1/4: Fixed bookkeeping of multiple class properties assigned on the same line
Date: Tue, 7 Feb 2023 00:01:19 -0500 (EST)

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

    Fixed bookkeeping of multiple class properties assigned on the same line
---
 phps-mode-parser-sdt.el    | 18 +++++++++++-------
 test/phps-mode-test-ast.el |  7 +++++++
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 1a385ec617..fad3ca1b64 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -4425,7 +4425,7 @@
 ;; 298 ((attributed_class_statement) (variable_modifiers 
optional_type_without_static property_list ";"))
 (puthash
  298
- (lambda(args terminals)
+ (lambda(args _terminals)
    `(
      ast-type
      property
@@ -4435,10 +4435,6 @@
      ,(nth 1 args)
      subject
      ,(nth 2 args)
-     ast-start
-     ,(car (cdr (car (nth 2 terminals))))
-     ast-end
-     ,(cdr (cdr (car (nth 2 terminals))))
      ))
  phps-mode-parser--table-translations)
 
@@ -4995,10 +4991,18 @@
 (puthash 336 (lambda(_args _terminals) 'readonly) 
phps-mode-parser--table-translations)
 
 ;; 337 ((property_list) (property_list "," property))
-(puthash 337 (lambda(args _terminals) (append (nth 0 args) (nth 2 args))) 
phps-mode-parser--table-translations)
+(puthash
+ 337
+ (lambda(args _terminals)
+   (append (nth 0 args) (list (nth 2 args))))
+ phps-mode-parser--table-translations)
 
 ;; 338 ((property_list) (property))
-(puthash 338 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
+(puthash
+ 338
+ (lambda(args _terminals)
+   (list args))
+ phps-mode-parser--table-translations)
 
 ;; 339 ((property) (T_VARIABLE backup_doc_comment))
 (puthash
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 5e96cf133b..f9934bd37f 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -130,6 +130,7 @@
   "Run test for bookkeeping generation."
   (message "-- Running tests for bookkeeping generation... --\n")
 
+  ;; 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
   ;; TODO v2 bookkeep and include all kind of constants in imenu
@@ -193,6 +194,12 @@
    '(((93 98) 1) ((127 132) 2) ((145 150) 3) ((160 165) 4) ((208 213) 5) ((263 
268) 5) ((270 274) 1) ((330 335) 0) ((392 397) 2) ((455 460) 2) ((510 515) 5) 
((517 521) 3) ((571 576) 5) ((578 582) 4) ((632 637) 5) ((639 643) 0) ((751 
756) 0))
    '(("class myParent" ("declaration" . 35)) ("class myClass" ("declaration" . 
54) ("$var1" . 93) ("$var2" . 127) ("$var3" . 145) ("$var4" . 160) ("function 
__construct" ("declaration" . 180)))))
 
+  (phps-mode-test-ast--should-bookkeep
+   "<?php\nclass myClass\n{\n    private $var = 123, $def = 'acb';\n}"
+   "Multiple class properties assigned on the same line."
+   '(((35 39) 1) ((47 51) 2))
+   '(("class myClass" ("declaration" . 13) ("$var" . 35) ("$def" . 47))))
+
   (phps-mode-test-ast--should-bookkeep
    "<?php\n\ntry {\n    \n} catch (\\Exception $e) {\n    if ($e) {\n        
echo 'Hit';\n    }\n}\n\nif ($e) {\n    echo 'Miss';\n}\n"
    "Bookkeeping of try catch variable assignment"



reply via email to

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