branch: externals/phps-mode
commit a8fecdfd684574dced52b908e3b3daf90dc718e0
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Bookkeeping of variables inside arrow functions now working
---
phps-mode-ast-bookkeeping.el | 11 +++++++----
test/phps-mode-test-ast.el | 2 +-
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index f2417c89ac..2c67e324bb 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -236,7 +236,8 @@
(let ((ids
(phps-mode-ast-bookkeeping--generate-variable-scope-string
scope
- (plist-get item 'name)))
+ (plist-get item 'name)
+ t))
(object
(list
(plist-get item 'start)
@@ -534,7 +535,7 @@
(plist-get item 'start)
(plist-get item 'end)))
(defined 1))
- ;; (message "id: %S from %S" id item)
+ ;; (message "ids: %S from %S" ids item)
(dolist (id ids)
(when-let ((predefined (gethash id bookkeeping)))
(setq
@@ -613,7 +614,8 @@
(variable-ids
(phps-mode-ast-bookkeeping--generate-variable-scope-string
sub-scope
- (concat "$" property-name)))
+ (concat "$" property-name)
+ t))
(symbol-id
(phps-mode-ast-bookkeeping--generate-symbol-scope-string
sub-scope
@@ -664,7 +666,8 @@
(variable-ids
(phps-mode-ast-bookkeeping--generate-variable-scope-string
sub-scope
- (plist-get member 'name)))
+ (plist-get member 'name)
+ t))
(bookkeeping-object
(list
(plist-get member 'start)
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index a3447172ac..9cf9250dce 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -537,7 +537,7 @@
(should
(equal
(phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
- '((" id $y" 1) ((7 9) 1) (" id $fn1" 1) ((15 19) 1) (" arrow function 1
id $x" 1) ((25 27) 1) ((32 34) 1) ((37 39) 1) (" id $z" 1) ((41 43) 1) (" id
$fn" 1) ((49 52) 1) (" arrow function 2 id $x2" 1) ((58 61) 1) (" arrow
function 2 arrow function 3 id $y2" 1) ((69 72) 1) ((77 80) 1) ((83 86) 1) ((89
91) 1) (" arrow function 3 id $x3" 1) ((102 105) 1) ((110 113) 1) (" id $x4" 1)
((115 118) 1) ((144 147) 1) (" arrow function 6 id $x5" 1) ((152 155) 1) ((165
168) 1) (" arrow function [...]
+ '((" id $y" 1) ((7 9) 1) (" id $fn1" 1) ((15 19) 1) (" arrow function 1
id $x" 1) ((25 27) 1) ((32 34) 1) ((37 39) 1) (" id $z" 1) ((41 43) 1) (" id
$fn" 1) ((49 52) 1) (" arrow function 2 id $x2" 1) ((58 61) 1) (" arrow
function 2 arrow function 3 id $y2" 1) ((69 72) 1) ((77 80) 1) ((83 86) 1) ((89
91) 1) (" arrow function 4 id $x3" 1) ((102 105) 1) ((110 113) 1) (" id $x4" 1)
((115 118) 1) ((144 147) 1) (" arrow function 6 id $x5" 1) ((152 155) 1) ((165
168) 1) (" arrow function [...]
(phps-mode-test-ast--buffer-contents
"<?php\n$z = (object) array('name' => 'random');\nif ($z->name) {\n echo
'Hit';\n}"