branch: scratch/javaimp-parse
commit e777d1bf285c66379f92cc75aab9333bc5184519
Author: Filipp Gunbin <fgun...@fastmail.fm>
Commit: Filipp Gunbin <fgun...@fastmail.fm>

    wip
---
 javaimp-parse.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/javaimp-parse.el b/javaimp-parse.el
index 4255aae..159b04d 100644
--- a/javaimp-parse.el
+++ b/javaimp-parse.el
@@ -155,10 +155,12 @@
 (defun javaimp--parse-scope-anonymous-class (state)
   (save-excursion
     ;; skip arg-list and ws
-    (when (and (ignore-errors
+    (when (and (progn
+                 (skip-syntax-backward "-")
+                 (= (char-before) ?\)))
+               (ignore-errors
                  (goto-char
-                  (scan-lists (nth 1 state) -1 0)))
-               (= (char-after) ?\())
+                  (scan-lists (point) -1 0))))
       (skip-syntax-backward "-")
       (let ((end (point)))
         (when (and (re-search-backward "\\<new\\s-+" nil t)
@@ -173,10 +175,12 @@
 
 (defun javaimp--parse-scope-method-or-stmt (state)
   (save-excursion
-    (when (and (ignore-errors
+    (when (and (progn
+                 (skip-syntax-backward "-")
+                 (= (char-before) ?\)))
+               (ignore-errors
                  (goto-char
-                  (scan-lists (nth 1 state) -1 0)))
-               (= (char-after) ?\())
+                  (scan-lists (point) -1 0))))
       (let* (;; leave open/close parens out
              (arglist-region (cons (1+ (point))
                                    (1- (scan-lists (point) 1 0))))

Reply via email to