Skip to content

Commit e92829d

Browse files
authored
Merge pull request #600 from DamienCassou/deprecation
Cleanup some deprecated code
2 parents dfbc6da + 06e8372 commit e92829d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

js2-mode.el

+21-21
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ parser as a frontend to an interpreter or byte compiler.")
778778

779779
;;; Parser instance variables (buffer-local vars for js2-parse)
780780

781-
(defconst js2-ti-after-eol (lsh 1 16)
781+
(defconst js2-ti-after-eol (ash 1 16)
782782
"Flag: first token of the source line.")
783783

784784
;; Inline Rhino's CompilerEnvirons vars as buffer-locals.
@@ -2129,8 +2129,8 @@ Returns nil if element is not found in the list."
21292129

21302130
(defsubst js2-same-line (pos)
21312131
"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))))
21342134

21352135
(defun js2-code-bug ()
21362136
"Signal an error when we encounter an unexpected code path."
@@ -5855,7 +5855,7 @@ corresponding number. Otherwise return -1."
58555855
(cl-decf c (- ?a 10))
58565856
(throw 'check nil))))
58575857
(throw 'return -1))
5858-
(logior c (lsh accumulator 4))))
5858+
(logior c (ash accumulator 4))))
58595859

58605860
(defun js2-get-token (&optional modifier)
58615861
"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."
84978497
(let ((pos (save-excursion
84988498
(goto-char (js2-current-token-end))
84998499
(max (js2-node-abs-pos (js2-function-node-body fn-node))
8500-
(point-at-bol))))
8500+
(line-beginning-position))))
85018501
(end (js2-current-token-end)))
85028502
(if (cl-plusp (js2-name-node-length name))
85038503
(js2-add-strict-warning "msg.no.return.value"
@@ -8655,7 +8655,7 @@ node are given relative start positions and correct lengths."
86558655
(setq end (js2-node-end pn))
86568656
(save-excursion
86578657
(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))))
86598659
(js2-add-strict-warning "msg.no.side.effects" nil beg end))
86608660
pn))
86618661

@@ -8698,7 +8698,7 @@ node are given relative start positions and correct lengths."
86988698
;; back up to beginning of statement or line
86998699
(max beg (save-excursion
87008700
(goto-char end)
8701-
(point-at-bol)))
8701+
(line-beginning-position)))
87028702
end)))
87038703

87048704
(defconst js2-no-semi-insertion
@@ -10767,7 +10767,7 @@ array-literals, array comprehensions and regular expressions."
1076710767
;; the scanner or one of its subroutines reported the error.
1076810768
(make-js2-error-node))
1076910769
((= tt js2-EOF)
10770-
(let* ((px-pos (point-at-bol))
10770+
(let* ((px-pos (line-beginning-position))
1077110771
(len (- js2-ts-cursor px-pos)))
1077210772
(js2-report-error "msg.unexpected.eof" nil px-pos len))
1077310773
(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.
1147211472
(defun js2-arglist-close ()
1147311473
"Return non-nil if we're on a line beginning with a close-paren/brace."
1147411474
(save-excursion
11475-
(goto-char (point-at-bol))
11475+
(goto-char (line-beginning-position))
1147611476
(js2-forward-sws)
1147711477
(looking-at "[])}]")))
1147811478

1147911479
(defun js2-indent-looks-like-label-p ()
11480-
(goto-char (point-at-bol))
11480+
(goto-char (line-beginning-position))
1148111481
(js2-forward-sws)
1148211482
(looking-at (concat js2-mode-identifier-re ":")))
1148311483

@@ -11512,7 +11512,7 @@ If HARDCODED-ARRAY-INDEX provided, array index in JSON path is replaced with it.
1151211512
(save-excursion
1151311513
(back-to-indentation)
1151411514
(js2-backward-sws)
11515-
(goto-char (point-at-bol))
11515+
(goto-char (line-beginning-position))
1151611516
(skip-chars-forward " \t")
1151711517
(looking-at "case\\s-.+:")))
1151811518

@@ -11562,9 +11562,9 @@ in reverse."
1156211562
;; line containing actual code.
1156311563
(setq pos (save-excursion
1156411564
(forward-line -1)
11565-
(goto-char (point-at-bol))
11565+
(goto-char (line-beginning-position))
1156611566
(when (re-search-forward "\\s-+\\(=\\)\\s-+"
11567-
(point-at-eol) t)
11567+
(line-end-position) t)
1156811568
(goto-char (match-end 1))
1156911569
(skip-chars-forward " \t\r\n")
1157011570
(current-column))))
@@ -11578,14 +11578,14 @@ in reverse."
1157811578
;; both this line and prev line look like object-literal
1157911579
;; elements.
1158011580
(setq pos (save-excursion
11581-
(goto-char (point-at-bol))
11581+
(goto-char (line-beginning-position))
1158211582
(js2-backward-sws)
1158311583
(back-to-indentation)
1158411584
(prog1
1158511585
(current-column)
1158611586
;; while we're here, look for trailing comma
1158711587
(if (save-excursion
11588-
(goto-char (point-at-eol))
11588+
(goto-char (line-end-position))
1158911589
(js2-backward-sws)
1159011590
(eq (char-before) ?,))
1159111591
(setq arglist-cont (1- (point)))))))
@@ -11694,7 +11694,7 @@ If so, we don't ever want to use bounce-indent."
1169411694
;; This has to be set before calling parse-partial-sexp below.
1169511695
(inhibit-point-motion-hooks t))
1169611696
(setq parse-status (save-excursion
11697-
(syntax-ppss (point-at-bol)))
11697+
(syntax-ppss (line-beginning-position)))
1169811698
offset (- (point) (save-excursion
1169911699
(back-to-indentation)
1170011700
(point))))
@@ -12327,14 +12327,14 @@ Also moves past comment delimiters when inside comments."
1232712327
(bolp)))
1232812328
(skip-chars-forward "\* \t"))
1232912329
(t
12330-
(goto-char (point-at-bol))))))
12330+
(goto-char (line-beginning-position))))))
1233112331

1233212332
(defun js2-end-of-line ()
1233312333
"Toggle point between eol and last non-whitespace char in line."
1233412334
(interactive)
1233512335
(if (eolp)
1233612336
(skip-chars-backward " \t")
12337-
(goto-char (point-at-eol))))
12337+
(goto-char (line-end-position))))
1233812338

1233912339
(defun js2-mode-wait-for-parse (callback)
1234012340
"Invoke CALLBACK when parsing is finished.
@@ -12548,13 +12548,13 @@ INDENT is the indentation level to match.
1254812548
Returns the end-of-line position of the furthest adjacent
1254912549
//-comment line with the same indentation as the current line.
1255012550
If there is no such matching line, returns current end of line."
12551-
(let ((pos (point-at-eol))
12551+
(let ((pos (line-end-position))
1255212552
(indent (current-indentation)))
1255312553
(save-excursion
1255412554
(while (and (zerop (forward-line direction))
1255512555
(looking-at js2-mode-//-comment-re)
1255612556
(eq indent (length (match-string 1))))
12557-
(setq pos (point-at-eol)))
12557+
(setq pos (line-end-position)))
1255812558
pos)))
1255912559

1256012560
(defun js2-mode-hide-//-comments ()
@@ -12574,7 +12574,7 @@ If there is no such matching line, returns current end of line."
1257412574
(defun js2-mode-toggle-//-comment ()
1257512575
"Fold or un-fold any multi-line //-comment at point.
1257612576
Caller should have determined that this line starts with a //-comment."
12577-
(let* ((beg (point-at-eol))
12577+
(let* ((beg (line-end-position))
1257812578
(end beg))
1257912579
(save-excursion
1258012580
(goto-char end)

0 commit comments

Comments
 (0)