branch: externals/phps-mode
commit 5ec32f5f5a183ad0f8b960811cfbd53957064e64
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
Bookkeeping via AST passing all tests
---
phps-mode-ast-bookkeeping.el | 4 ++--
test/phps-mode-test-ast.el | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index 7f314eb05a..de400478eb 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -684,10 +684,10 @@
(setq
static-p
t))))
+ (when static-p
+ (push '(type static) sub-scope))
(if (stringp subject)
(let ((ids))
- (when static-p
- (push '(type static) sub-scope))
(setq
ids
(phps-mode-ast-bookkeeping--generate-variable-scope-string
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index c46ebc41c4..5a5e558630 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -409,11 +409,10 @@
"Bookkeeping of $this reference inside arrow function inside of method"
'((" class myClass id $test" 1) ((36 41) 1) (" class myClass function test
id $this" 1) (" class myClass function test id $d" 1) ((76 78) 1) (" class
myClass function test arrow function 1 id $e" 1) ((104 106) 1) ((111 116) 1)
((118 122) 1) ((125 127) 1) ((130 132) 1) (" id $a" 1) ((143 145) 1)))
- ;; TODO Make this test pass
(phps-mode-test-ast--should-bookkeep
"<?php class myClass { static $var = '123'; static function myMethod($a) {
return fn($b) => self::$var . $a . $b; }} echo myClass::myMethod('4')('5');"
"Bookkeeping of self reference inside arrow function inside of static
method"
- '((" class myClass id $var" 1) ((30 34) 1) (" class myClass function
myMethod id $a" 1) ((69 71) 1) (" class myClass function myMethod arrow
function 1 id $b" 1) ((85 87) 1) ((98 102) 1) ((105 107) 1) ((110 112) 1)))
+ '((" class myClass static id $var" 1) ((30 34) 1) (" class myClass function
myMethod id $a" 1) ((69 71) 1) (" class myClass function myMethod arrow
function 1 id $b" 1) ((85 87) 1) ((98 102) 1) ((105 107) 1) ((110 112) 1)))
(message "\n-- Ran tests for bookkeeping generation. --"))