branch: master
commit 76b7f45f7c664486a412b00dbc6a1468fc03c46e
Author: Jason Bell <[email protected]>
Commit: Jason Bell <[email protected]>
fix bug jumping to function def in shorthand property:value literal
---
js2-mode.el | 3 ++-
tests/navigation.el | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/js2-mode.el b/js2-mode.el
index 8543c73..6aca826 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12746,7 +12746,8 @@ it marks the next defun after the ones already marked."
(error "Node is not a supported jump node"))
(push (or (and names (pop names))
(unless (and (js2-object-prop-node-p parent)
- (eq node (js2-object-prop-node-left parent)))
+ (eq node (js2-object-prop-node-left parent))
+ (not (js2-node-get-prop parent 'SHORTHAND)))
node)
(error "Node is not a supported jump node")) names)
(setq node-init (js2-search-scope node names))
diff --git a/tests/navigation.el b/tests/navigation.el
index a8ec0cd..26431da 100644
--- a/tests/navigation.el
+++ b/tests/navigation.el
@@ -74,6 +74,9 @@
"function aFunction(p1, p2) {return p1+p2}; module.exports =
{aFunction:aFunction};"
67 16 "Node is not a supported jump node"))
+(ert-deftest js2-jump-to-function-inside-property-value-syntax ()
+ (js2-navigation-helper "function aFunction(p1, p2) {return p1+p2};
module.exports = {aFunction};" 1 6))
+
;; forward-sexp