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
(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)
(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';")