[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 28853c9 03/22: do auto semicolon insert on function export
From: |
Dmitry Gutov |
Subject: |
[elpa] master 28853c9 03/22: do auto semicolon insert on function exports |
Date: |
Fri, 24 Apr 2015 02:57:08 +0000 |
branch: master
commit 28853c91a2a15d0414da5cdb05f755fa658317f7
Author: Charles Lowell <address@hidden>
Commit: Charles Lowell <address@hidden>
do auto semicolon insert on function exports
---
js2-mode.el | 11 ++++++++---
tests/parser.el | 10 ++++++++++
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/js2-mode.el b/js2-mode.el
index 2fd0630..4045c94 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -8094,7 +8094,8 @@ node are given relative start positions and correct
lengths."
js2-ERROR
js2-SEMI
js2-CLASS
- js2-FUNCTION)
+ js2-FUNCTION
+ js2-EXPORT)
"List of tokens that don't do automatic semicolon insertion.")
(defconst js2-autoinsert-semi-and-warn
@@ -8529,9 +8530,13 @@ invalid export statements."
(when from-clause
(push from-clause children))
(when declaration
- (push declaration children))
+ (push declaration children)
+ (when (not (js2-function-node-p declaration))
+ (js2-auto-insert-semicolon declaration)))
(when default
- (push default children))
+ (push default children)
+ (when (not (js2-function-node-p default))
+ (js2-auto-insert-semicolon default)))
(let ((node (make-js2-export-node
:pos beg
:len (- (js2-current-token-end) beg)
diff --git a/tests/parser.el b/tests/parser.el
index b4f2d8f..8c44028 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -608,6 +608,16 @@ the test."
(should export-node)
(should (js2-export-node-default export-node))))
+(js2-deftest export-function-no-semicolon "export default function foo() {}"
+ (js2-mode)
+ (should (equal nil js2-parsed-warnings)))
+(js2-deftest export-default-function-no-semicolon "export function foo() {}"
+ (js2-mode)
+ (should (equal nil js2-parsed-warnings)))
+(js2-deftest export-anything-else-does-require-a-semicolon "export var obj =
{}"
+ (js2-mode)
+ (should (not (equal nil js2-parsed-warnings))))
+
(js2-deftest-parse parse-export-rexport "export * from 'other/lib';")
(js2-deftest-parse parse-export-export-named-list "export {foo, bar as bang};")
(js2-deftest-parse parse-re-export-named-list "export {foo, bar as bang} from
'other/lib';")
- [elpa] master updated (c10ba4b -> 54df259), Dmitry Gutov, 2015/04/23
- [elpa] master fae5776 01/22: Check that the let declaration comes before the reference, Dmitry Gutov, 2015/04/23
- [elpa] master dd2106b 02/22: Merge branch 'let-temporal-dz', Dmitry Gutov, 2015/04/23
- [elpa] master 28853c9 03/22: do auto semicolon insert on function exports,
Dmitry Gutov <=
- [elpa] master dfad0d5 04/22: Merge pull request #211 from cowboyd/no-semicolon-warning-on-function-export, Dmitry Gutov, 2015/04/23
- [elpa] master 02fea21 06/22: Merge pull request #213 from lelit/typos, Dmitry Gutov, 2015/04/23
- [elpa] master bf454ef 05/22: Fix typos in comments and docstrings, Dmitry Gutov, 2015/04/23
- [elpa] master 7bf479a 08/22: Fix js2-paren-node length, Dmitry Gutov, 2015/04/23
- [elpa] master 4d8ec67 07/22: Rely on bogus scopes less, Dmitry Gutov, 2015/04/23
- [elpa] master 4a1b4e8 09/22: Parse without error first method in a class with keyword name, Dmitry Gutov, 2015/04/23
- [elpa] master 90a9056 10/22: ...or any following one, Dmitry Gutov, 2015/04/23
- [elpa] master bc61ce0 11/22: Fix off-by-one error for comment node length, Dmitry Gutov, 2015/04/23
- [elpa] master 3b76567 12/22: Fix js2-node-get-enclosing-scope, Dmitry Gutov, 2015/04/23
- [elpa] master 458d3fe 14/22: Merge pull request #221 from jacksonrayhamilton/enclosing-scope, Dmitry Gutov, 2015/04/23