[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 8fa61fa1f2 063/212: Passing bookkeeping of in
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 8fa61fa1f2 063/212: Passing bookkeeping of interface method arguments |
Date: |
Wed, 26 Jan 2022 01:50:44 -0500 (EST) |
branch: externals/phps-mode
commit 8fa61fa1f254bc49620577aef5d3059fe9e898c9
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Passing bookkeeping of interface method arguments
---
phps-mode-ast-bookkeeping.el | 43 +++++++++++++++++++++++++++++++------------
phps-mode-parser-sdt.el | 7 +++++++
2 files changed, 38 insertions(+), 12 deletions(-)
diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index 79946fbec7..dceac2a81f 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -310,22 +310,41 @@
(dolist (child children)
(push `(,sub-scope ,child) bookkeeping-stack)))))
+ ((equal type 'return-statement)
+ (when-let ((expr (reverse (plist-get item 'optional-expr))))
+ (dolist (e expr)
+ (push `(,scope ,e) bookkeeping-stack))))
+
((equal type 'method)
(let ((name (plist-get item 'name))
- (sub-scope scope))
+ (sub-scope scope)
+ (parent-is-interface)
+ (is-static))
(push `(type function name ,name) sub-scope)
- ;; TODO should only do this is method is not static
- ;; TODO should only do this if method is not in a interface class
- (let ((this-ids
- (phps-mode-ast-bookkeeping--generate-variable-scope-string
- sub-scope
- "$this")))
- (dolist (this-id this-ids)
- (puthash
- this-id
- 1
- bookkeeping)))
+ (when-let ((modifiers (plist-get item 'modifiers)))
+ (dolist (modifier modifiers)
+ (when (equal modifier 'static)
+ (setq
+ is-static
+ t))))
+
+ (when (equal (plist-get (car scope) 'type) 'interface)
+ (setq parent-is-interface t))
+
+ (unless (or
+ is-static
+ parent-is-interface)
+ (let ((this-ids
+
(phps-mode-ast-bookkeeping--generate-variable-scope-string
+ sub-scope
+ "$this")))
+ (dolist (this-id this-ids)
+ (puthash
+ this-id
+ 1
+ bookkeeping))))
+
(when-let ((parameter-list (reverse (plist-get item
'parameter-list))))
(dolist (parameter parameter-list)
(let ((ids
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index fc47b97d72..957ab4a76b 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -161,6 +161,13 @@
ast-object))
phps-mode-parser--table-translations)
+;; statement -> (T_RETURN optional_expr ";")
+(puthash
+ 149
+ (lambda(args _terminals)
+ `(ast-stype return-statement optional-expr
,(phps-mode-parser-sdt--get-list-of-object (nth 1 args))))
+ phps-mode-parser--table-translations)
+
;; statement -> (T_GLOBAL global_var_list ";")
(puthash
150
- [elpa] externals/phps-mode 442ad93cb2 018/212: Fix for function parameter formatting in AST, (continued)
- [elpa] externals/phps-mode 442ad93cb2 018/212: Fix for function parameter formatting in AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2a4d5dea37 019/212: Passed bookkeeping of function arguments, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode c29e35fea2 021/212: More work on bookkeeping, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0daaa97f8d 025/212: SDT for for() loop started, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode fa3681141b 027/212: Passed test for bookkeeping of conditional assignment via parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode fc4c763d68 030/212: Added SDT for class properties, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f7c261cee1 032/212: Generate parser command now compatible with latest emacs-parser-generator, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f82c9a377d 033/212: Re-generated parser to verify automation functionality, improved automation documentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f858060096 034/212: More work on bookkeeping generated from parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode c83b1c264e 060/212: Fixed SDT for isset_variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 8fa61fa1f2 063/212: Passing bookkeeping of interface method arguments,
Christian Johansson <=
- [elpa] externals/phps-mode 7a636ccd28 078/212: Removed obsolete file parser-grammar-macro.el, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode ee211dac6a 084/212: Started on indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f65ca852cd 092/212: Passed another indent test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 9a2573939a 094/212: More wrestling, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7c0cb57312 098/212: Added more multi-line assignment indent tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 3a594466d5 100/212: Passed indent test for multi-line assignments, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7deebc5f79 101/212: Improved indent test descriptions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d5d80017bc 104/212: Passed indent tests for concatenated string, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e083e90ac0 108/212: Passing more indentation tests for PSR-2, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 84d447e4e6 119/212: Added TODO item, Christian Johansson, 2022/01/26