branch: externals/phps-mode
commit 432382eddb6882f1b5da1d4653338711d68900c6
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Added bookkeeping support for global variables in functions
---
phps-mode-ast-bookkeeping.el | 13 +++++++++++++
phps-mode-parser-sdt.el | 13 +++++++++++++
2 files changed, 26 insertions(+)
diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index 0655bf0091..e048469f17 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -398,6 +398,19 @@
defined
bookkeeping)))
+ ((equal type 'global-statement)
+ (when-let ((global-var-list (reverse (plist-get item
'global-var-list))))
+ (dolist (global-var global-var-list)
+ (push
+ (list
+ scope
+ (list
+ 'ast-type
+ 'assign-variable
+ 'key
+ global-var))
+ bookkeeping-stack))))
+
((equal type 'assign-variables-from-array)
(when-let ((keys (reverse (plist-get item 'keys))))
(dolist (key keys)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index b2e391d749..46a06251be 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -161,6 +161,19 @@
ast-object))
phps-mode-parser--table-translations)
+;; statement -> (T_GLOBAL global_var_list ";")
+(puthash
+ 150
+ (lambda(args _terminals)
+ (let ((ast-object
+ (list
+ 'ast-type
+ 'global-statement
+ 'global-var-list
+ (phps-mode-parser-sdt--get-list-of-object (nth 1 args)))))
+ ast-object))
+ phps-mode-parser--table-translations)
+
;; statement -> (T_ECHO echo_expr_list ";")
(puthash
152