Closed fengjian closed 2 years ago
(defun ac-js2-find-property (list-names) "Find the property definition that consists of LIST-NAMES. Supports navigation to 'foo.bar = 3' and 'foo = {bar: 3}'." (catch 'prop-found (js2-visit-ast-root js2-mode-ast (lambda (node endp) (let ((parent (js2-node-parent node))) (unless endp (if (or (and (js2-prop-get-node-p node) (not (or (js2-elem-get-node-p parent) (js2-call-node-p parent))) ;;error: arrayp ;; (equal list-names (ac-js2-build-prop-name-list node)) t ) (and (js2-name-node-p node) (js2-object-prop-node-p parent) (string= (js2-name-node-name node) (first list-names)))) (throw 'prop-found node)) t))))))