[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 30e9fa14ff 075/212: Added a failing bookkeepi
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 30e9fa14ff 075/212: Added a failing bookkeeping test |
Date: |
Wed, 26 Jan 2022 01:50:54 -0500 (EST) |
branch: externals/phps-mode
commit 30e9fa14ff3666106d0c7b2c42495e16ac539348
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Added a failing bookkeeping test
---
phps-mode-ast-bookkeeping.el | 20 +++++++++++++++++++-
test/phps-mode-test-ast.el | 7 ++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index e0b7ec01b7..7f314eb05a 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -862,7 +862,25 @@
(cond
((equal member-type 'simple-variable)
- (let ((sub-scope (cdr scope)))
+ ;; When current scope is arrow function
+ ;; we should go up in scope until we get out of
+ ;; arrow functions scope
+ (let ((sub-scope scope)
+ (head-scope)
+ (is-arrow-function-scope t))
+ (while (and
+ sub-scope
+ is-arrow-function-scope)
+ (setq
+ head-scope
+ (car sub-scope))
+ (setq
+ sub-scope
+ (cdr sub-scope))
+ (unless (equal
+ (plist-get head-scope 'type)
+ 'arrow-function)
+ (setq is-arrow-function-scope nil)))
(push '(type static) sub-scope)
(let ((predefined)
(variable-ids
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 1f223b9484..c46ebc41c4 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -404,12 +404,17 @@
"Bookkeeping of $this not available inside static method"
'(((68 73) 0) (" class MyClass function there id $this" 1) ((153 158) 1)))
- ;; TODO Make this test pass
(phps-mode-test-ast--should-bookkeep
"<?php\n\nclass myClass\n{\n private $test = 'abc';\n public function
test($d)\n {\n return fn($e) => $this->test . $d . $e;\n
}\n}\n\n$a = new myClass();\necho $a->test('def')('ghi');"
"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)))
+
(message "\n-- Ran tests for bookkeeping generation. --"))
(defun phps-mode-test-ast ()
- [elpa] externals/phps-mode d4f0db2c0c 211/212: Added failing bookkeeping test, (continued)
- [elpa] externals/phps-mode d4f0db2c0c 211/212: Added failing bookkeeping test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode cb4d95cd7a 204/212: Passed new indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a907f103f0 026/212: More work on AST for bookkeeping, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 95078e0db2 029/212: Added SDT for increment variable production, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d90b470109 035/212: Fixed bookkeeping of class property, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode bcf0c68945 038/212: AST-imenu and AST-bookkeeping now in standalone files, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4e021b8413 046/212: Bookkeeping via AST now passing method calls, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 712f5e9f2b 049/212: Removed invalid syntax code from old bookkeeping test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1dc3b453c9 043/212: Passed bookkeeping via AST for try catch blocks, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 882e6f75dc 062/212: Work on SDT for interface methods, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 30e9fa14ff 075/212: Added a failing bookkeeping test,
Christian Johansson <=
- [elpa] externals/phps-mode 16ce2acfb7 077/212: Removed debug output for bookkeeping, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode bc5039e32f 086/212: Created custom determine string indentation function, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode daff4ad5e0 085/212: More work on indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode b82475c697 090/212: Passed token-blind indentation for multi-line class extends and implements, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2ea2360c3e 091/212: Created indent helper functions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode df91b8e433 117/212: More handling of string-doc indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 6fac0d5585 102/212: Passed indent test for heredoc string, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 1af63142f3 127/212: Fixed incremental issue with new SDT based bookkeeping, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 3565c7efb3 125/212: Fixed byte-compilation warnings for indent file, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a8097b5b5e 147/212: Improved indentation on line after equal operator in if condition list, Christian Johansson, 2022/01/26