emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 7e4293b 01/38: Parse all default exports as expressions


From: Dmitry Gutov
Subject: [elpa] master 7e4293b 01/38: Parse all default exports as expressions
Date: Wed, 28 Feb 2018 20:12:07 -0500 (EST)

branch: master
commit 7e4293b2eb21ec28f1faa12eec6a2eed3aa48eba
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Parse all default exports as expressions
    
    Fixes #438
---
 js2-mode.el     | 6 +++---
 tests/parser.el | 7 ++++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index bb17d4f..2f2df7b 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -9044,14 +9044,14 @@ invalid export statements."
         (setq from-clause (js2-parse-from-clause))))
      ((js2-match-token js2-DEFAULT)
       (setq default (cond ((js2-match-token js2-CLASS)
-                           (js2-parse-class-stmt))
+                           (js2-parse-class-expr))
                           ((js2-match-token js2-NAME)
                            (if (js2-match-async-function)
-                               (js2-parse-async-function-stmt)
+                               (js2-parse-function-expr t)
                              (js2-unget-token)
                              (js2-parse-expr)))
                           ((js2-match-token js2-FUNCTION)
-                           (js2-parse-function-stmt))
+                           (js2-parse-function-expr))
                           (t (js2-parse-expr)))))
      ((or (js2-match-token js2-VAR) (js2-match-token js2-CONST) 
(js2-match-token js2-LET))
       (setq declaration (js2-parse-variables (js2-current-token-type) 
(js2-current-token-beg))))
diff --git a/tests/parser.el b/tests/parser.el
index 482ec8f..25bda07 100644
--- a/tests/parser.el
+++ b/tests/parser.el
@@ -869,8 +869,9 @@ the test."
 (js2-deftest-parse parse-re-export-named-list "export {foo, bar as bang} from 
'other/lib';")
 (js2-deftest-parse parse-export-const-declaration "export const PI = Math.PI;")
 (js2-deftest-parse parse-export-let-declaration "export let foo = [1];")
-(js2-deftest-parse parse-export-function-declaration "export default function 
doStuff() {\n}")
-(js2-deftest-parse parse-export-generator-declaration "export default 
function* one() {\n}")
+(js2-deftest-parse parse-export-default-function "export default function() 
{}")
+(js2-deftest-parse parse-export-default-generator "export default function*() 
{}")
+(js2-deftest-parse parse-export-default-class "export default class {\n}")
 (js2-deftest-parse parse-export-assignment-expression "export default a = b;")
 
 (js2-deftest-parse parse-export-function-declaration-no-semi
@@ -883,7 +884,7 @@ the test."
   "export async function f() {\n  await f();\n}")
 
 (js2-deftest-parse parse-export-default-async-function-allow-await
-  "export default async function f() {\n  await f();\n}")
+  "export default async function f() {  await f();\n}")
 
 ;;; Strings
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]