Commit 2e330adc authored by Chong Yidong's avatar Chong Yidong
Browse files

* progmodes/js.el: Edit docstrings throughout to follow Emacs

conventions.
(js-insert-and-indent): Function deleted.
(js-mode-map): Don't bind keys to js-insert-and-indent.
(js-beginning-of-defun): Rename from js--beginning-of-defun.
(js-end-of-defun): Rename from js--end-of-defun.
(js-auto-indent-flag): Variable deleted.
parent ba2d8894
2009-08-15 Chong Yidong <cyd@stupidchicken.com>
* progmodes/js.el: Edit docstrings throughout to follow Emacs
conventions.
(js-insert-and-indent): Function deleted.
(js-mode-map): Don't bind keys to js-insert-and-indent.
(js-beginning-of-defun): Rename from js--beginning-of-defun.
(js-end-of-defun): Rename from js--end-of-defun.
(js-auto-indent-flag): Variable deleted.
2009-08-14 Chong Yidong <cyd@stupidchicken.com>
* progmodes/js.el: Remove proclaim statement. Defvar
which-func-imenu-joiner-function to silence compiler.
* files.el (auto-mode-alist): Use js-mode for .js files.
* progmodes/js2-mode.el: File removed.
......
;;; js.el --- Major mode for editing JavaScript source text
;;; js.el --- Major mode for editing JavaScript
;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
......@@ -59,9 +59,7 @@
(eval-when-compile
(require 'cl)
(require 'comint)
(require 'ido)
;; Swap the speed and safety values for debugging
(proclaim '(optimize (speed 3) (safety 0))))
(require 'ido))
(defvar inferior-moz-buffer)
(defvar moz-repl-name)
......@@ -72,55 +70,56 @@
;;; Constants
(defconst js--name-start-re "[a-zA-Z_$]"
"Matches the first character of a Javascript identifier. No grouping")
"Regexp matching the start of a JavaScript identifier, without grouping.")
(defconst js--stmt-delim-chars "^;{}?:")
(defconst js--name-re (concat js--name-start-re
"\\(?:\\s_\\|\\sw\\)*")
"Matches a Javascript identifier. No grouping.")
"Regexp matching a JavaScript identifier, without grouping.")
(defconst js--objfield-re (concat js--name-re ":")
"Matches a Javascript object field start")
"Regexp matching the start of a JavaScript object field.")
(defconst js--dotted-name-re
(concat js--name-re "\\(?:\\." js--name-re "\\)*")
"Matches a dot-separated sequence of Javascript names")
"Regexp matching a dot-separated sequence of JavaScript names.")
(defconst js--cpp-name-re js--name-re
"Matches a C preprocessor name")
"Regexp matching a C preprocessor name.")
(defconst js--opt-cpp-start "^\\s-*#\\s-*\\([[:alnum:]]+\\)"
"Regexp matching the prefix of a cpp directive including the directive
name, or nil in languages without preprocessor support. The first
submatch surrounds the directive name.")
"Regexp matching the prefix of a cpp directive.
This includes the directive name, or nil in languages without
preprocessor support. The first submatch surrounds the directive
name.")
(defconst js--plain-method-re
(concat "^\\s-*?\\(" js--dotted-name-re "\\)\\.prototype"
"\\.\\(" js--name-re "\\)\\s-*?=\\s-*?\\(function\\)\\_>")
"Regexp matching an old-fashioned explicit prototype \"method\"
declaration. Group 1 is a (possibly-dotted) class name, group 2
is a method name, and group 3 is the 'function' keyword." )
"Regexp matching an explicit JavaScript prototype \"method\" declaration.
Group 1 is a (possibly-dotted) class name, group 2 is a method
name, and group 3 is the 'function' keyword." )
(defconst js--plain-class-re
(concat "^\\s-*\\(" js--dotted-name-re "\\)\\.prototype"
"\\s-*=\\s-*{")
"Regexp matching an old-fashioned explicit prototype \"class\"
declaration, as in Class.prototype = { method1: ...} ")
"Regexp matching a JavaScript explicit prototype \"class\" declaration.
An example of this is \"Class.prototype = { method1: ...}\".")
;; var NewClass = BaseClass.extend(
(defconst js--mp-class-decl-re
(concat "^\\s-*var\\s-+"
"\\(" js--name-re "\\)"
"\\s-*=\\s-*"
"\\(" js--dotted-name-re
"\\)\\.extend\\(?:Final\\)?\\s-*(\\s-*{?\\s-*$")
"var NewClass = BaseClass.extend(")
"\\)\\.extend\\(?:Final\\)?\\s-*(\\s-*{?\\s-*$"))
;; var NewClass = Class.create()
(defconst js--prototype-obsolete-class-decl-re
(concat "^\\s-*\\(?:var\\s-+\\)?"
"\\(" js--dotted-name-re "\\)"
"\\s-*=\\s-*Class\\.create()")
"var NewClass = Class.create()")
"\\s-*=\\s-*Class\\.create()"))
(defconst js--prototype-objextend-class-decl-re-1
(concat "^\\s-*Object\\.extend\\s-*("
......@@ -132,14 +131,14 @@ submatch surrounds the directive name.")
"\\(" js--dotted-name-re "\\)"
"\\s-*=\\s-*Object\\.extend\\s-*\("))
;; var NewClass = Class.create({
(defconst js--prototype-class-decl-re
(concat "^\\s-*\\(?:var\\s-+\\)?"
"\\(" js--name-re "\\)"
"\\s-*=\\s-*Class\\.create\\s-*(\\s-*"
"\\(?:\\(" js--dotted-name-re "\\)\\s-*,\\s-*\\)?{?")
"var NewClass = Class.create({")
"\\(?:\\(" js--dotted-name-re "\\)\\s-*,\\s-*\\)?{?"))
;; Parent class name(s) (yes, multiple inheritance in Javascript) are
;; Parent class name(s) (yes, multiple inheritance in JavaScript) are
;; matched with dedicated font-lock matchers
(defconst js--dojo-class-decl-re
(concat "^\\s-*dojo\\.declare\\s-*(\"\\(" js--dotted-name-re "\\)"))
......@@ -148,19 +147,19 @@ submatch surrounds the directive name.")
(concat "^\\s-*Ext\\.extend\\s-*("
"\\s-*\\(" js--dotted-name-re "\\)"
"\\s-*,\\s-*\\(" js--dotted-name-re "\\)")
"ExtJS class declaration (style 1)")
"Regexp matching an ExtJS class declaration (style 1).")
(defconst js--extjs-class-decl-re-2
(concat "^\\s-*\\(?:var\\s-+\\)?"
"\\(" js--name-re "\\)"
"\\s-*=\\s-*Ext\\.extend\\s-*(\\s-*"
"\\(" js--dotted-name-re "\\)")
"ExtJS class declaration (style 2)")
"Regexp matching an ExtJS class declaration (style 2).")
(defconst js--mochikit-class-re
(concat "^\\s-*MochiKit\\.Base\\.update\\s-*(\\s-*"
"\\(" js--dotted-name-re "\\)")
"MochiKit class declaration?")
"Regexp matching a MochiKit class declaration.")
(defconst js--dummy-class-style
'(:name "[Automatically Generated Class]"))
......@@ -221,7 +220,7 @@ submatch surrounds the directive name.")
:contexts (toplevel)
:framework merrillpress))
"A list of class definition styles.
"List of JavaScript class definition styles.
A class definition style is a plist with the following keys:
......@@ -249,36 +248,34 @@ name as matched contains
unless (memq framework available-frameworks)
collect framework into available-frameworks
finally return available-frameworks)
"List of available frameworks symbols")
"List of available JavaScript frameworks symbols.")
(defconst js--function-heading-1-re
(concat
"^\\s-*function\\s-+\\(" js--name-re "\\)")
"Regular expression matching the start of a function header. Match group 1
is the name of the function.")
"Regexp matching the start of a JavaScript function header.
Match group 1 is the name of the function.")
(defconst js--function-heading-2-re
(concat
"^\\s-*\\(" js--name-re "\\)\\s-*:\\s-*function\\_>")
"Regular expression matching the start of a function entry in
an associative array. Match group 1 is the name of the function.")
"Regexp matching the start of a function entry in an associative array.
Match group 1 is the name of the function.")
(defconst js--function-heading-3-re
(concat
"^\\s-*\\(?:var\\s-+\\)?\\(" js--dotted-name-re "\\)"
"\\s-*=\\s-*function\\_>")
"Matches a line in the form var MUMBLE = function. Match group
1 is MUMBLE.")
"Regexp matching a line in the JavaScript form \"var MUMBLE = function\".
Match group 1 is MUMBLE.")
(defconst js--macro-decl-re
(concat "^\\s-*#\\s-*define\\s-+\\(" js--cpp-name-re "\\)\\s-*(")
"Regular expression matching a CPP macro definition up to the opening
parenthesis. Match group 1 is the name of the function.")
"Regexp matching a CPP macro definition, up to the opening parenthesis.
Match group 1 is the name of the function.")
(defun js--regexp-opt-symbol (list)
"Like regexp-opt, but surround the optimized regular expression
with `\\\\_<' and `\\\\_>'."
"Like `regexp-opt', but surround the result with `\\\\_<' and `\\\\_>'."
(concat "\\_<" (regexp-opt list t) "\\_>"))
(defconst js--keyword-re
......@@ -292,7 +289,7 @@ with `\\\\_<' and `\\\\_>'."
"super" "switch" "synchronized" "throw"
"throws" "transient" "try" "typeof" "var" "void" "let"
"yield" "volatile" "while" "with"))
"Regular expression matching any JavaScript keyword.")
"Regexp matching any JavaScript keyword.")
(defconst js--basic-type-re
(js--regexp-opt-symbol
......@@ -312,7 +309,7 @@ with `\\\\_<' and `\\\\_>'."
"\\_<import\\_>"
(list js--function-heading-1-re 1 font-lock-function-name-face)
(list js--function-heading-2-re 1 font-lock-function-name-face))
"Level one font lock.")
"Level one font lock keywords for `js-mode'.")
(defconst js--font-lock-keywords-2
(append js--font-lock-keywords-1
......@@ -322,7 +319,7 @@ with `\\\\_<' and `\\\\_>'."
(list 1 'font-lock-keyword-face))
(cons js--basic-type-re font-lock-type-face)
(cons js--constant-re font-lock-constant-face)))
"Level two font lock.")
"Level two font lock keywords for `js-mode'.")
;; js--pitem is the basic building block of the lexical
;; database. When one refers to a real part of the buffer, the region
......@@ -415,55 +412,45 @@ with `\\\\_<' and `\\\\_>'."
;;
(b-end nil))
;; The pitem we start parsing with.
(defconst js--initial-pitem
(make-js--pitem
:paren-depth most-negative-fixnum
:type 'toplevel)
"The pitem we start parsing with")
:type 'toplevel))
;;; User Customization
(defgroup js nil
"Customization variables for `js-mode'."
"Customization variables for JavaScript mode."
:tag "JavaScript"
:group 'languages)
(defcustom js-indent-level 4
"Number of spaces for each indentation step."
"Number of spaces for each indentation step in `js-mode'."
:type 'integer
:group 'js)
(defcustom js-expr-indent-offset 0
"Number of additional spaces used for indentation of continued
expressions. The value must be no less than minus
`js-indent-level'."
"Number of additional spaces used for indentation of continued expressions.
The value must be no less than minus `js-indent-level'."
:type 'integer
:group 'js)
(defcustom js-auto-indent-flag t
"Automatic indentation with punctuation characters. If non-nil, the
current line is indented when certain punctuations are inserted."
:type 'boolean
:group 'js)
(defcustom js-flat-functions nil
"Treat nested functions as if they were top-level functions for
function movement, marking, and so on."
"Treat nested functions as top-level functions in `js-mode'.
This applies to function movement, marking, and so on."
:type 'boolean
:group 'js)
(defcustom js-comment-lineup-func #'c-lineup-C-comments
"cc-mode-style lineup function for C comments"
"Lineup function for `cc-mode-style', for C comments in `js-mode'."
:type 'function
:group 'js)
(defcustom js-enabled-frameworks js--available-frameworks
"Select which frameworks js-mode will recognize.
Turn off some frameworks you seldom use to improve performance.
The set of recognized frameworks can also be overriden on a
per-buffer basis."
"Frameworks recognized by `js-mode'.
To improve performance, you may turn off some frameworks you
seldom use, either globally or on a per-buffer basis."
:type (cons 'set (mapcar (lambda (x)
(list 'const x))
js--available-frameworks))
......@@ -471,23 +458,24 @@ per-buffer basis."
(defcustom js-js-switch-tabs
(and (memq system-type '(darwin)) t)
"Non-nil if Emacs should display tabs while selecting them.
Useful only if the windowing system has a good mechanism for
preventing Firefox from stealing the keyboard focus."
"Whether `js-mode' should display tabs while selecting them.
This is useful only if the windowing system has a good mechanism
for preventing Firefox from stealing the keyboard focus."
:type 'boolean
:group 'js)
(defcustom js-js-tmpdir
"~/.emacs.d/js/js"
"Temporary directory used for communicating with Mozilla. It
must be readable and writable by both Mozilla and Emacs."
"Temporary directory used by `js-mode' to communicate with Mozilla.
This directory must be readable and writable by both Mozilla and
Emacs."
:type 'directory
:group 'js)
(defcustom js-js-timeout 5
"Wait this many seconds for a reply from Mozilla when executing
commands. Increase this value if you are getting timeout
messages."
"Reply timeout for executing commands in Mozilla via `js-mode'.
The value is given in seconds. Increase this value if you are
getting timeout messages."
:type 'integer
:group 'js)
......@@ -495,14 +483,10 @@ messages."
(defvar js-mode-map
(let ((keymap (make-sparse-keymap)))
(mapc (lambda (key)
(define-key keymap key #'js-insert-and-indent))
'("+" "-" "*" "{" "}" "(" ")" ":" ";" ","))
(define-key keymap [(control ?c) (meta ?:)] #'js-eval)
(define-key keymap [(control ?c) (control ?j)] #'js-set-js-context)
(define-key keymap [(control meta ?x)] #'js-eval-defun)
(define-key keymap [(meta ?.)] #'js-find-symbol)
(easy-menu-define nil keymap "Javascript Menu"
'("Javascript"
["Select new Mozilla context…" js-set-js-context
......@@ -510,26 +494,9 @@ messages."
["Evaluate expression in Mozilla context…" js-eval
(fboundp #'inferior-moz-process)]
["Send current function to Mozilla…" js-eval-defun
(fboundp #'inferior-moz-process)]
)
)
(fboundp #'inferior-moz-process)]))
keymap)
"Keymap for js-mode")
(defun js-insert-and-indent (key)
"Runs the command bound to KEY in the global keymap, and if
we're not in a string or comment, indents the current line."
(interactive (list (this-command-keys)))
(call-interactively (lookup-key (current-global-map) key))
(let ((syntax (save-restriction (widen) (syntax-ppss))))
(when (or (and (not (nth 8 syntax))
js-auto-indent-flag)
(and (nth 4 syntax)
(eq (current-column)
(1+ (current-indentation)))))
(indent-according-to-mode))))
"Keymap for `js-mode'.")
;;; Syntax table and parsing
......@@ -538,50 +505,50 @@ we're not in a string or comment, indents the current line."
(c-populate-syntax-table table)
(modify-syntax-entry ?$ "_" table)
table)
"Syntax table used in JS mode.")
"Syntax table for `js-mode'.")
(defvar js--quick-match-re nil
"Autogenerated regular expression to match buffer constructs")
"Autogenerated regexp used by `js-mode' to match buffer constructs.")
(defvar js--quick-match-re-func nil
"Autogenerated regular expression to match buffer constructs
and functions")
"Autogenerated regexp used by `js-mode' to match constructs and functions.")
(make-variable-buffer-local 'js--quick-match-re)
(make-variable-buffer-local 'js--quick-match-re-func)
(defvar js--cache-end 1
"Last place in the buffer the function cache is valid")
"Last valid buffer position for the `js-mode' function cache.")
(make-variable-buffer-local 'js--cache-end)
(defvar js--last-parse-pos nil
"Last place we parsed up to in js--ensure-cache")
"Latest parse position reached by `js--ensure-cache'.")
(make-variable-buffer-local 'js--last-parse-pos)
(defvar js--state-at-last-parse-pos nil
"pstate at js--last-parse-pos")
"Parse state at `js--last-parse-pos'.")
(make-variable-buffer-local 'js--state-at-last-parse-pos)
(defun js--flatten-list (list)
(loop for item in list
nconc (cond ((consp item)
(js--flatten-list item))
(item (list item)))))
(defun js--maybe-join (prefix separator suffix &rest list)
"If LIST contains any element that is not nil, return its
non-nil elements, separated by SEPARATOR, prefixed by PREFIX, and
ended with SUFFIX as with `concat'. Otherwise, if LIST is empty,
return nil. If any element in LIST is itself a list, flatten that
"Helper function for `js--update-quick-match-re'.
If LIST contains any element that is not nil, return its non-nil
elements, separated by SEPARATOR, prefixed by PREFIX, and ended
with SUFFIX as with `concat'. Otherwise, if LIST is empty, return
nil. If any element in LIST is itself a list, flatten that
element."
(setq list (js--flatten-list list))
(when list
(concat prefix (mapconcat #'identity list separator) suffix)))
(defun js--update-quick-match-re ()
"Update js--quick-match-re based on the current set of
enabled frameworks"
"Internal function used by `js-mode' for caching buffer constructs.
This updates `js--quick-match-re', based on the current set of
enabled frameworks."
(setq js--quick-match-re
(js--maybe-join
"^[ \t]*\\(?:" "\\|" "\\)"
......@@ -631,9 +598,9 @@ enabled frameworks"
(concat "function\\|" js--quick-match-re)))
(defun js--forward-text-property (propname)
"Move over the next value of PROPNAME in the buffer. If found,
return that value and leave point after the character having that
value, otherwise return nil and leave point at EOB."
"Move over the next value of PROPNAME in the buffer.
If found, return that value and leave point after the character
having that value; otherwise, return nil and leave point at EOB."
(let ((next-value (get-text-property (point) propname)))
(if next-value
(forward-char)
......@@ -647,9 +614,10 @@ value, otherwise return nil and leave point at EOB."
next-value))
(defun js--backward-text-property (propname)
"Move over the previous value of PROPNAME in the buffer. If found,
return that value and leave point just before the character that
has that value, otherwise return nil and leave point at BOB."
"Move over the previous value of PROPNAME in the buffer.
If found, return that value and leave point just before the
character that has that value, otherwise return nil and leave
point at BOB."
(unless (bobp)
(let ((prev-value (get-text-property (1- (point)) propname)))
(if prev-value
......@@ -675,7 +643,7 @@ has that value, otherwise return nil and leave point at BOB."
(js--forward-pstate))
(defun js--re-search-forward-inner (regexp &optional bound count)
"Auxiliary function for `js--re-search-forward'."
"Helper function for `js--re-search-forward'."
(let ((parse)
str-terminator
(orig-macro-end (save-excursion
......@@ -706,14 +674,12 @@ has that value, otherwise return nil and leave point at BOB."
(defun js--re-search-forward (regexp &optional bound noerror count)
"Search forward but ignore strings, cpp macros, and comments.
Invokes `re-search-forward' but treats the buffer as if strings,
cpp macros, and comments have been removed.
If invoked while inside a macro, treat the contents of the macro
as normal text.
"Search forward, ignoring strings, cpp macros, and comments.
This function invokes `re-search-forward', but treats the buffer
as if strings, cpp macros, and comments have been removed.
"
If invoked while inside a macro, it treats the contents of the
macro as normal text."
(let ((saved-point (point))
(search-expr
(cond ((null count)
......@@ -764,12 +730,13 @@ as normal text.
(defun js--re-search-backward (regexp &optional bound noerror count)
"Search backward but ignore strings, preprocessor macros, and
comments. Invokes `re-search-backward' but treats the buffer as
if strings, preprocessor macros, and comments have been removed.
"Search backward, ignoring strings, preprocessor macros, and comments.
This function invokes `re-search-backward' but treats the buffer
as if strings, preprocessor macros, and comments have been
removed.
If inside a macro when called, treat the macro as normal text.
"
If invoked while inside a macro, treat the macro as normal text."
(let ((saved-point (point))
(search-expr
(cond ((null count)
......@@ -786,8 +753,9 @@ If inside a macro when called, treat the macro as normal text.
(error (error-message-string err)))))))
(defun js--forward-expression ()
"Move forward over a whole expression. Doesn't move over
expressions continued across lines, but we don't actually care"
"Move forward over a whole JavaScript expression.
This function doesn't move over expressions continued across
lines."
(loop
;; non-continued case; simplistic, but good enough?
do (loop until (or (eolp)
......@@ -802,11 +770,12 @@ expressions continued across lines, but we don't actually care"
(js--continued-expression-p)))))
(defun js--forward-function-decl ()
"Move forward over a function declaration with point at the
'function' keyword. Return non-nil if this is a
syntactically-correct non-expression function, nil otherwise.
Specifically, return the name of the function, or t if the name
could not be determined."
"Move forward over a JavaScript function declaration.
This puts point at the 'function' keyword.
If this is a syntactically-correct non-expression function,
return the name of the function, or t if the name could not be
determined. Otherwise, return nil."
(assert (looking-at "\\_<function\\_>"))
(let ((name t))
(forward-word)
......@@ -822,11 +791,10 @@ could not be determined."
name)))))
(defun js--function-prologue-beginning (&optional pos)
"Return the start of the function prologue that contains POS,
or nil if we're not in a function prologue. A function prologue
is everything from start of the definition up to and including
the opening brace. POS defaults to point."
"Return the start of the JavaScript function prologue containing POS.
A function prologue is everything from start of the definition up
to and including the opening brace. POS defaults to point.
If POS is not in a function prologue, return nil."
(let (prologue-begin)
(save-excursion
(if pos
......@@ -853,9 +821,10 @@ the opening brace. POS defaults to point."
(or prologue-begin (match-beginning 0))))))
(defun js--beginning-of-defun-raw ()
"Internal helper for js--beginning-of-defun. Go to
previous defun-beginning and return the parse state for it, or
nil if we went all the way back to bob and don't find anything."
"Helper function for `js-beginning-of-defun'.
Go to previous defun-beginning and return the parse state for it,
or nil if we went all the way back to bob and don't find
anything."
(js--ensure-cache)
(let (pstate)
(while (and (setq pstate (js--backward-pstate))
......@@ -863,8 +832,9 @@ nil if we went all the way back to bob and don't find anything."
(and (not (bobp)) pstate)))
(defun js--pstate-is-toplevel-defun (pstate)
"If PSTATE represents a non-empty top-level defun, return the
top-most pitem. Otherwise, return nil."
"Helper function for `js--beginning-of-defun-nested'.
If PSTATE represents a non-empty top-level defun, return the
top-most pitem. Otherwise, return nil."
(loop for pitem in pstate
with func-depth = 0
with func-pitem
......@@ -874,9 +844,8 @@ top-most pitem. Otherwise, return nil."
finally return (if (eq func-depth 1) func-pitem)))
(defun js--beginning-of-defun-nested ()
"Internal helper for js--beginning-of-defun. Returns the
pitem of the function we went to the beginning of."
"Helper function for `js--beginning-of-defun'.
Return the pitem of the function we went to the beginning of."
(or
;; Look for the smallest function that encloses point...
(loop for pitem in (js--parse-state-at-point)
......@@ -894,22 +863,20 @@ pitem of the function we went to the beginning of."
and return it)))
(defun js--beginning-of-defun-flat ()
"Internal helper for js--beginning-of-defun"
"Helper function for `js-beginning-of-defun'."
(let ((pstate (js--beginning-of-defun-raw)))
(when pstate
(goto-char (js--pitem-h-begin (car pstate))))))
(defun js--beginning-of-defun (&optional arg)
"Used as beginning-of-defun-function"
(defun js-beginning-of-defun (&optional arg)
"Value of `beginning-of-defun-function' for `js-mode'."
(setq arg (or arg 1))
(while (and (not (eobp)) (< arg 0))
(incf arg)
(when (and (not js-flat-functions)
(or (eq (js-syntactic-context) 'function)
(js--function-prologue-beginning)))
(js--end-of-defun))
(js-end-of-defun))
(if (js--re-search-forward
"\\_<function\\_>" nil t)
......@@ -933,8 +900,8 @@ pitem of the function we went to the beginning of."
(js--beginning-of-defun-nested))))))
(defun js--flush-caches (&optional beg ignored)
"Flush syntax cache info after position BEG. BEG defaults to
point-min, flushing the entire cache."
"Flush the `js-mode' syntax cache after position BEG.
BEG defaults to point-min, meaning to flush the entire cache."
(interactive)
(setq beg (or beg (save-restriction (widen) (point-min))))
(setq js--cache-end (min js--cache-end beg)))
......@@ -955,14 +922,13 @@ point-min, flushing the entire cache."
;; that assumption holds.
(cons (js--pitem-add-child (second open-items) top-item)
(cddr open-items)))))
open-items)
(defmacro js--ensure-cache--update-parse ()
"Helper for use inside js--ensure-cache. Updates parsing
information up to point. Refers to parse, prev-parse-point,
goal-point, and open-items bound lexically in the body of
`js--ensure-cache'."
"Helper function for `js--ensure-cache'.
Update parsing information up to point, referring to parse,
prev-parse-point, goal-point, and open-items bound lexically in
the body of `js--ensure-cache'."