[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 83d9890 070/110: Fix await parsing
From: |
Dmitry Gutov |
Subject: |
[elpa] master 83d9890 070/110: Fix await parsing |
Date: |
Thu, 23 Jun 2016 01:13:00 +0000 (UTC) |
branch: master
commit 83d98906e29ad69ecd6971d809425e2d79c4409f
Author: Jackson Hamilton <address@hidden>
Commit: Jackson Hamilton <address@hidden>
Fix await parsing
---
js2-mode.el | 11 ++++++++++-
tests/parser.el | 6 ++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/js2-mode.el b/js2-mode.el
index b20edd1..87a5f2c 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7766,7 +7766,16 @@ string is NAME. Returns nil and keeps current token
otherwise."
(defun js2-match-await (tt)
(when (and (= tt js2-NAME)
- (js2-contextual-kwd-p (js2-current-token) "await"))
+ (js2-contextual-kwd-p (js2-current-token) "await")
+ ;; Per the proposal, AwaitExpression consists of "await"
+ ;; followed by a UnaryExpression. So look ahead for one.
+ (let ((ts-state (make-js2-ts-state))
+ js2-recorded-identifiers
+ js2-parsed-errors)
+ (js2-get-token)
+ (prog1
+ (/= (js2-node-type (js2-parse-unary-expr)) js2-ERROR)
+ (js2-ts-seek ts-state))))
(js2-record-face 'font-lock-keyword-face)
(let ((beg (js2-current-token-beg))
(end (js2-current-token-end)))
diff --git a/tests/parser.el b/tests/parser.el
index b3c3620..2111671 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -499,6 +499,12 @@ the test."
(js2-deftest-parse async-can-be-function-name
"function async() {\n}")
+(js2-deftest-parse await-can-be-name
+ "void await;")
+
+(js2-deftest-parse await-can-be-object-name
+ "await.z;")
+
(js2-deftest-parse await-can-be-var-name
"var await = 3;")
- [elpa] master e265b69 090/110: Fix a byte compilation warning on Emacs 25, (continued)
- [elpa] master e265b69 090/110: Fix a byte compilation warning on Emacs 25, Dmitry Gutov, 2016/06/22
- [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 <=
- [elpa] master bacb022 074/110: Refactor async arrow function matching, Dmitry Gutov, 2016/06/22
- [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