"Signal an error when we encounter an unexpected code path."
(error "failed assertion"))
+(defsubst js2-record-text-property (beg end prop value)
+ "Record a text property to set when parsing finishes."
+ (push (list beg end prop value) js2-mode-deferred-properties))
+
;; I'd like to associate errors with nodes, but for now the
;; easiest thing to do is get the context info from the last token.
(defsubst js2-record-parse-error (msg &optional arg pos len)
point-entered nil
c-in-sws nil)))
-(defsubst js2-record-text-property (beg end prop value)
- "Record a text property to set when parsing finishes."
- (push (list beg end prop value) js2-mode-deferred-properties))
-
(defconst js2-ecma-global-props
(concat "^"
(regexp-opt
(defun js2-record-name-node (node)
"Saves NODE to `js2-recorded-identifiers' to check for undeclared variables
later. NODE must be a name node."
- (push (list node js2-current-scope
- (setq leftpos (js2-node-abs-pos node))
- (setq end (+ leftpos (js2-node-len node))))
- js2-recorded-identifiers))
+ (let (leftpos end)
+ (push (list node js2-current-scope
+ (setq leftpos (js2-node-abs-pos node))
+ (setq end (+ leftpos (js2-node-len node))))
+ js2-recorded-identifiers)))
(defun js2-highlight-undeclared-vars ()
"After entire parse is finished, look for undeclared variable references.
"Modify function-declaration name chains after parsing finishes.
Some of the information is only available after the parse tree is complete.
For instance, following a 'this' reference requires a parent function node."
- (let (result head fn parent-chain p elem)
+ (let (result head fn parent-chain p elem parent)
(dolist (chain chains)
;; examine the head of each node to get its defining scope
(setq head (car chain))