@@ -778,7 +778,7 @@ parser as a frontend to an interpreter or byte compiler.")
778
778
779
779
;;; Parser instance variables (buffer-local vars for js2-parse)
780
780
781
- (defconst js2-ti-after-eol (lsh 1 16)
781
+ (defconst js2-ti-after-eol (ash 1 16)
782
782
"Flag: first token of the source line.")
783
783
784
784
;; Inline Rhino's CompilerEnvirons vars as buffer-locals.
@@ -2129,8 +2129,8 @@ Returns nil if element is not found in the list."
2129
2129
2130
2130
(defsubst js2-same-line (pos)
2131
2131
"Return t if POS is on the same line as current point."
2132
- (and (>= pos (point-at-bol ))
2133
- (<= pos (point-at-eol ))))
2132
+ (and (>= pos (line-beginning-position ))
2133
+ (<= pos (line-end-position ))))
2134
2134
2135
2135
(defun js2-code-bug ()
2136
2136
"Signal an error when we encounter an unexpected code path."
@@ -5855,7 +5855,7 @@ corresponding number. Otherwise return -1."
5855
5855
(cl-decf c (- ?a 10))
5856
5856
(throw 'check nil))))
5857
5857
(throw 'return -1))
5858
- (logior c (lsh accumulator 4))))
5858
+ (logior c (ash accumulator 4))))
5859
5859
5860
5860
(defun js2-get-token (&optional modifier)
5861
5861
"If `js2-ti-lookahead' is zero, call scanner to get new token.
@@ -8497,7 +8497,7 @@ Last token scanned is the close-curly for the function body."
8497
8497
(let ((pos (save-excursion
8498
8498
(goto-char (js2-current-token-end))
8499
8499
(max (js2-node-abs-pos (js2-function-node-body fn-node))
8500
- (point-at-bol ))))
8500
+ (line-beginning-position ))))
8501
8501
(end (js2-current-token-end)))
8502
8502
(if (cl-plusp (js2-name-node-length name))
8503
8503
(js2-add-strict-warning "msg.no.return.value"
@@ -8655,7 +8655,7 @@ node are given relative start positions and correct lengths."
8655
8655
(setq end (js2-node-end pn))
8656
8656
(save-excursion
8657
8657
(goto-char end)
8658
- (setq beg (max (js2-node-pos pn) (point-at-bol ))))
8658
+ (setq beg (max (js2-node-pos pn) (line-beginning-position ))))
8659
8659
(js2-add-strict-warning "msg.no.side.effects" nil beg end))
8660
8660
pn))
8661
8661
@@ -8698,7 +8698,7 @@ node are given relative start positions and correct lengths."
8698
8698
;; back up to beginning of statement or line
8699
8699
(max beg (save-excursion
8700
8700
(goto-char end)
8701
- (point-at-bol )))
8701
+ (line-beginning-position )))
8702
8702
end)))
8703
8703
8704
8704
(defconst js2-no-semi-insertion
@@ -10767,7 +10767,7 @@ array-literals, array comprehensions and regular expressions."
10767
10767
;; the scanner or one of its subroutines reported the error.
10768
10768
(make-js2-error-node))
10769
10769
((= tt js2-EOF)
10770
- (let* ((px-pos (point-at-bol ))
10770
+ (let* ((px-pos (line-beginning-position ))
10771
10771
(len (- js2-ts-cursor px-pos)))
10772
10772
(js2-report-error "msg.unexpected.eof" nil px-pos len))
10773
10773
(make-js2-error-node :pos (1- js2-ts-cursor)))
@@ -11472,12 +11472,12 @@ If HARDCODED-ARRAY-INDEX provided, array index in JSON path is replaced with it.
11472
11472
(defun js2-arglist-close ()
11473
11473
"Return non-nil if we're on a line beginning with a close-paren/brace."
11474
11474
(save-excursion
11475
- (goto-char (point-at-bol ))
11475
+ (goto-char (line-beginning-position ))
11476
11476
(js2-forward-sws)
11477
11477
(looking-at "[])}]")))
11478
11478
11479
11479
(defun js2-indent-looks-like-label-p ()
11480
- (goto-char (point-at-bol ))
11480
+ (goto-char (line-beginning-position ))
11481
11481
(js2-forward-sws)
11482
11482
(looking-at (concat js2-mode-identifier-re ":")))
11483
11483
@@ -11512,7 +11512,7 @@ If HARDCODED-ARRAY-INDEX provided, array index in JSON path is replaced with it.
11512
11512
(save-excursion
11513
11513
(back-to-indentation)
11514
11514
(js2-backward-sws)
11515
- (goto-char (point-at-bol ))
11515
+ (goto-char (line-beginning-position ))
11516
11516
(skip-chars-forward " \t")
11517
11517
(looking-at "case\\s-.+:")))
11518
11518
@@ -11562,9 +11562,9 @@ in reverse."
11562
11562
;; line containing actual code.
11563
11563
(setq pos (save-excursion
11564
11564
(forward-line -1)
11565
- (goto-char (point-at-bol ))
11565
+ (goto-char (line-beginning-position ))
11566
11566
(when (re-search-forward "\\s-+\\(=\\)\\s-+"
11567
- (point-at-eol ) t)
11567
+ (line-end-position ) t)
11568
11568
(goto-char (match-end 1))
11569
11569
(skip-chars-forward " \t\r\n")
11570
11570
(current-column))))
@@ -11578,14 +11578,14 @@ in reverse."
11578
11578
;; both this line and prev line look like object-literal
11579
11579
;; elements.
11580
11580
(setq pos (save-excursion
11581
- (goto-char (point-at-bol ))
11581
+ (goto-char (line-beginning-position ))
11582
11582
(js2-backward-sws)
11583
11583
(back-to-indentation)
11584
11584
(prog1
11585
11585
(current-column)
11586
11586
;; while we're here, look for trailing comma
11587
11587
(if (save-excursion
11588
- (goto-char (point-at-eol ))
11588
+ (goto-char (line-end-position ))
11589
11589
(js2-backward-sws)
11590
11590
(eq (char-before) ?,))
11591
11591
(setq arglist-cont (1- (point)))))))
@@ -11694,7 +11694,7 @@ If so, we don't ever want to use bounce-indent."
11694
11694
;; This has to be set before calling parse-partial-sexp below.
11695
11695
(inhibit-point-motion-hooks t))
11696
11696
(setq parse-status (save-excursion
11697
- (syntax-ppss (point-at-bol )))
11697
+ (syntax-ppss (line-beginning-position )))
11698
11698
offset (- (point) (save-excursion
11699
11699
(back-to-indentation)
11700
11700
(point))))
@@ -12327,14 +12327,14 @@ Also moves past comment delimiters when inside comments."
12327
12327
(bolp)))
12328
12328
(skip-chars-forward "\* \t"))
12329
12329
(t
12330
- (goto-char (point-at-bol ))))))
12330
+ (goto-char (line-beginning-position ))))))
12331
12331
12332
12332
(defun js2-end-of-line ()
12333
12333
"Toggle point between eol and last non-whitespace char in line."
12334
12334
(interactive)
12335
12335
(if (eolp)
12336
12336
(skip-chars-backward " \t")
12337
- (goto-char (point-at-eol ))))
12337
+ (goto-char (line-end-position ))))
12338
12338
12339
12339
(defun js2-mode-wait-for-parse (callback)
12340
12340
"Invoke CALLBACK when parsing is finished.
@@ -12548,13 +12548,13 @@ INDENT is the indentation level to match.
12548
12548
Returns the end-of-line position of the furthest adjacent
12549
12549
//-comment line with the same indentation as the current line.
12550
12550
If there is no such matching line, returns current end of line."
12551
- (let ((pos (point-at-eol ))
12551
+ (let ((pos (line-end-position ))
12552
12552
(indent (current-indentation)))
12553
12553
(save-excursion
12554
12554
(while (and (zerop (forward-line direction))
12555
12555
(looking-at js2-mode-//-comment-re)
12556
12556
(eq indent (length (match-string 1))))
12557
- (setq pos (point-at-eol )))
12557
+ (setq pos (line-end-position )))
12558
12558
pos)))
12559
12559
12560
12560
(defun js2-mode-hide-//-comments ()
@@ -12574,7 +12574,7 @@ If there is no such matching line, returns current end of line."
12574
12574
(defun js2-mode-toggle-//-comment ()
12575
12575
"Fold or un-fold any multi-line //-comment at point.
12576
12576
Caller should have determined that this line starts with a //-comment."
12577
- (let* ((beg (point-at-eol ))
12577
+ (let* ((beg (line-end-position ))
12578
12578
(end beg))
12579
12579
(save-excursion
12580
12580
(goto-char end)
0 commit comments