]> code.delx.au - gnu-emacs-elpa/commitdiff
js2-mode-find-enclosing-node: Make docstring and impl consistent with name
authorLeo Liu <sdl.web@gmail.com>
Fri, 31 Oct 2014 01:07:16 +0000 (04:07 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 31 Oct 2014 01:07:16 +0000 (04:07 +0300)
Closes #170

js2-mode.el

index 0ba16c9b0ac2196380855a891319584d4d477e45..e5683a27b850ea192bdd79dbd177c63e8ae274b8 100644 (file)
@@ -4547,16 +4547,16 @@ Returns nil if NODE is not inside a function."
       (setq node (js2-node-parent node)))
     node))
 
-(defun js2-mode-find-enclosing-node (beg end)
-  "Find script or function fully enclosing BEG and END."
+ (defun js2-mode-find-enclosing-node (beg end)
+  "Find node fully enclosing BEG and END."
   (let ((node (js2-node-at-point beg))
         pos
         (continue t))
     (while continue
       (if (or (js2-ast-root-p node)
-              (and (js2-function-node-p node)
-                   (<= (setq pos (js2-node-abs-pos node)) beg)
-                   (>= (+ pos (js2-node-len node)) end)))
+              (and
+               (<= (setq pos (js2-node-abs-pos node)) beg)
+               (>= (+ pos (js2-node-len node)) end)))
           (setq continue nil)
         (setq node (js2-node-parent node))))
     node))