[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 28/46: js2-parse-let: Simplify
From: |
Dmitry Gutov |
Subject: |
[elpa] 28/46: js2-parse-let: Simplify |
Date: |
Sat, 15 Nov 2014 20:58:06 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit b7299de07943e7bc4fbc53c8dcbea5a3a07fba5d
Author: Dmitry Gutov <address@hidden>
Date: Mon Sep 8 23:42:33 2014 +0400
js2-parse-let: Simplify
---
js2-mode.el | 3 +--
tests/parser.el | 3 +++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index ec261e7..81060d1 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -8462,7 +8462,7 @@ by `js2-parse-variables'."
(setq vars (js2-parse-variables js2-LET (js2-current-token-beg)))
(if (js2-must-match js2-RP "msg.no.paren.let")
(setf (js2-let-node-rp pn) (- (js2-current-token-beg) pos)))
- (if (and stmt-p (eq (js2-get-token) js2-LC))
+ (if (and stmt-p (js2-match-token js2-LC))
;; let statement
(progn
(setf beg (js2-current-token-beg) ; position stmt at LC
@@ -8473,7 +8473,6 @@ by `js2-parse-variables'."
(js2-let-node-body pn) body
(js2-node-type pn) js2-LET))
;; let expression
- (when stmt-p (js2-unget-token))
(setf body (js2-parse-expr)
(js2-node-len pn) (- (js2-node-end body) pos)
(js2-let-node-body pn) body))
diff --git a/tests/parser.el b/tests/parser.el
index 37d9afa..1df9603 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -124,6 +124,9 @@ the test."
(js2-deftest-parse let-expression
"(let (x = 42) x);")
+(js2-deftest-parse let-expression-statement
+ "let (x = 42) x;")
+
;;; Callers of `js2-valid-prop-name-token'
(js2-deftest-parse parse-property-access-when-not-keyword
- [elpa] 14/46: Support ES6 generator comprehensions, (continued)
- [elpa] 14/46: Support ES6 generator comprehensions, Dmitry Gutov, 2014/11/15
- [elpa] 13/46: Support ES6 array comprehensions, Dmitry Gutov, 2014/11/15
- [elpa] 12/46: Add `.' to electric-indent-chars for method continuations, Dmitry Gutov, 2014/11/15
- [elpa] 15/46: Add Contributing section, Dmitry Gutov, 2014/11/15
- [elpa] 24/46: Small tweak, Dmitry Gutov, 2014/11/15
- [elpa] 23/46: Add js2-language-version checks, Dmitry Gutov, 2014/11/15
- [elpa] 25/46: Ignore integer overflow, Dmitry Gutov, 2014/11/15
- [elpa] 26/46: Allow 'in' operator inside 'for' init when unambiguous, Dmitry Gutov, 2014/11/15
- [elpa] 27/46: Fix parsing of let expressions, Dmitry Gutov, 2014/11/15
- [elpa] 18/46: Merge pull request #149 from lewang/dont-parse-killed-buffer, Dmitry Gutov, 2014/11/15
- [elpa] 28/46: js2-parse-let: Simplify,
Dmitry Gutov <=
- [elpa] 22/46: Support ES6 number literals, Dmitry Gutov, 2014/11/15
- [elpa] 21/46: js2-get-token-internal-1: add a FIXME, Dmitry Gutov, 2014/11/15
- [elpa] 20/46: js2-read-unicode-escape: use a stricter regexp, Dmitry Gutov, 2014/11/15
- [elpa] 29/46: Fontify negation operator, Dmitry Gutov, 2014/11/15
- [elpa] 32/46: Fix #171, Dmitry Gutov, 2014/11/15
- [elpa] 31/46: js2-mode-find-enclosing-node: Make docstring and impl consistent with name, Dmitry Gutov, 2014/11/15
- [elpa] 33/46: js2-parse-primary-expr: Make some vars "more" local, Dmitry Gutov, 2014/11/15
- [elpa] 34/46: Add imenu support for the Sencha framework, Dmitry Gutov, 2014/11/15
- [elpa] 36/46: Indent before inequality operator at bol, Dmitry Gutov, 2014/11/15
- [elpa] 38/46: Indent after `+=', Dmitry Gutov, 2014/11/15