[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master bacb022 074/110: Refactor async arrow function matching
From: |
Dmitry Gutov |
Subject: |
[elpa] master bacb022 074/110: Refactor async arrow function matching |
Date: |
Thu, 23 Jun 2016 01:13:00 +0000 (UTC) |
branch: master
commit bacb02222dbe9dcd7a6f7cccb473933aa839b4b4
Author: Jackson Hamilton <address@hidden>
Commit: Jackson Hamilton <address@hidden>
Refactor async arrow function matching
---
js2-mode.el | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index f66294e..049fd8d 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7749,21 +7749,10 @@ string is NAME. Returns nil and keeps current token
otherwise."
(js2-get-token)
t))
-;; Matching "async" is performed in two parts, because in the functions' one
use
-;; case, it isn't known whether an arrow function is actually being parsed (and
-;; thus whether `js2-get-token' should be called) until later. If
-;; `js2-get-token' were called eccentrically, `js2-current-token' would be
-;; off-by-one, causing `js2-parse-unary-expr' to potentially fail when "async"
-;; is used in a non-keyword context.
-
-(defun js2-match-async-arrow-function-1 ()
+(defun js2-match-async-arrow-function ()
(and (js2-contextual-kwd-p (js2-current-token) "async")
(/= (js2-peek-token) js2-FUNCTION)))
-(defun js2-match-async-arrow-function-2 ()
- (js2-record-face 'font-lock-keyword-face)
- (js2-get-token))
-
(defun js2-parse-await-maybe (tt)
"Parse \"await\" as an AwaitExpression, if it is one."
(let (pn post-parse-ts-state)
@@ -9705,7 +9694,7 @@ If NODE is non-nil, it is the AST node associated with
the symbol."
;; `js2-parse-function-stmt' nor `js2-parse-function-expr' that
;; interpret `async` token, we trash `async` and just remember
;; we met `async` keyword to `async-p'.
- (when (js2-match-async-arrow-function-1)
+ (when (js2-match-async-arrow-function)
(setq async-p t))
;; Save the tokenizer state in case we find an arrow function
;; and have to rewind.
@@ -9741,7 +9730,8 @@ If NODE is non-nil, it is the AST node associated with
the symbol."
(>= js2-language-version 200))
(js2-ts-seek ts-state)
(when async-p
- (js2-match-async-arrow-function-2))
+ (js2-record-face 'font-lock-keyword-face)
+ (js2-get-token))
(setq js2-recorded-identifiers recorded-identifiers
js2-parsed-errors parsed-errors)
(setq pn (js2-parse-function 'FUNCTION_ARROW (js2-current-token-beg)
nil async-p)))
- [elpa] master 87f43f3 089/110: Fix more remaining failures, (continued)
- [elpa] master 87f43f3 089/110: Fix more remaining failures, Dmitry Gutov, 2016/06/22
- [elpa] master 6d22df2 094/110: Colorize imported names as variables, Dmitry Gutov, 2016/06/22
- [elpa] master bc46db5 104/110: Add a test for #335 as well, Dmitry Gutov, 2016/06/22
- [elpa] master 92f5479 108/110: Parse generator methods better, Dmitry Gutov, 2016/06/22
- [elpa] master 58857dc 103/110: Merge branch 'dgreensp-object-rest-spread', Dmitry Gutov, 2016/06/22
- [elpa] master 0cda392 109/110: Make a new release, Dmitry Gutov, 2016/06/22
- [elpa] master be0b00d 063/110: js2-mode-extend-comment: Don't check that the next line is also commented, Dmitry Gutov, 2016/06/22
- [elpa] master 757f91d 065/110: And move its definition below, Dmitry Gutov, 2016/06/22
- [elpa] master 7e0b11f 071/110: Add tests for of parsing, Dmitry Gutov, 2016/06/22
- [elpa] master 83d9890 070/110: Fix await parsing, Dmitry Gutov, 2016/06/22
- [elpa] master bacb022 074/110: Refactor async arrow function matching,
Dmitry Gutov <=
- [elpa] master 57dca37 073/110: Refactor await parsing to only parse once, Dmitry Gutov, 2016/06/22
- [elpa] master 60f7a2b 080/110: Fix computed property generator methods indentation, Dmitry Gutov, 2016/06/22
- [elpa] master de6df33 049/110: Fix semicolons and scoping in exported decls, Dmitry Gutov, 2016/06/22
- [elpa] master dbf4fe9 038/110: Adapt async/await changes to latest master, Dmitry Gutov, 2016/06/22
- [elpa] master 7fe7165 053/110: Fix array destructuring including triple-dot, Dmitry Gutov, 2016/06/22
- [elpa] master d1bf11f 068/110: Fix void parsing, Dmitry Gutov, 2016/06/22
- [elpa] master 7b430a3 079/110: Merge pull request #308 from zmwangx/jsdoc-callback-func-method, Dmitry Gutov, 2016/06/22
- [elpa] master c988876 086/110: Fix the straggler, Dmitry Gutov, 2016/06/22
- [elpa] master 6399bec 001/110: Support ES(7) async/await syntax; Closes #185, Dmitry Gutov, 2016/06/22
- [elpa] master fa0aa09 060/110: Merge pull request #294 from lunaryorn/patch-1, Dmitry Gutov, 2016/06/22