From: Carl Lei Date: Mon, 9 Nov 2015 02:28:35 +0000 (+0800) Subject: Do not print trailing semicolon for export function and class X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/38aa66bec00d8d4703da97d8a59ac4c669417545 Do not print trailing semicolon for export function and class --- diff --git a/js2-mode.el b/js2-mode.el index bf7219afd..2e5b21014 100644 --- a/js2-mode.el +++ b/js2-mode.el @@ -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 diff --git a/tests/parser.el b/tests/parser.el index 79481c89d..198e5780c 100644 --- a/tests/parser.el +++ b/tests/parser.el @@ -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