]> code.delx.au - gnu-emacs-elpa/commitdiff
Do not print trailing semicolon for export function and class
authorCarl Lei <xecycle@gmail.com>
Mon, 9 Nov 2015 02:28:35 +0000 (10:28 +0800)
committerCarl Lei <xecycle@gmail.com>
Mon, 9 Nov 2015 02:31:45 +0000 (10:31 +0800)
js2-mode.el
tests/parser.el

index bf7219afd404c7b578731d2de2a7bddd72b0a2e7..2e5b21014f7fcd6d65bc6d8333cdbe279361d0a4 100644 (file)
@@ -2551,7 +2551,9 @@ so many of its properties will be nil.
       (js2-print-from-clause from))
      (exports-list
       (js2-print-named-imports exports-list)))
-    (unless (and default (not (js2-assign-node-p default)))
+    (unless (or (and default (not (js2-assign-node-p default)))
+                (and declaration (or (js2-function-node-p declaration)
+                                     (js2-class-node-p declaration))))
       (insert ";\n"))))
 
 (cl-defstruct (js2-while-node
index 79481c89deb27f0893173e87db43aaab3d1999cc..198e5780c4ce1cb070c33fc025fc3d893bd05ec8 100644 (file)
@@ -799,6 +799,12 @@ the test."
 (js2-deftest-parse parse-export-generator-declaration "export default function* one() {\n}")
 (js2-deftest-parse parse-export-assignment-expression "export default a = b;")
 
+(js2-deftest-parse parse-export-function-declaration-no-semi
+  "export function f() {\n}")
+
+(js2-deftest-parse parse-export-class-declaration-no-semi
+  "export class C {\n}")
+
 ;;; Strings
 
 (js2-deftest-parse string-literal