From d1bf11f83df6b1824ac958b1ec827c5e1d6dfae7 Mon Sep 17 00:00:00 2001 From: Jackson Hamilton Date: Sat, 2 Jan 2016 14:58:17 -0800 Subject: [PATCH] Fix void parsing --- js2-mode.el | 4 +++- tests/parser.el | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/js2-mode.el b/js2-mode.el index f574aee94..85c3ee965 100644 --- a/js2-mode.el +++ b/js2-mode.el @@ -3479,6 +3479,7 @@ The type field inherited from `js2-node' holds the operator." (cons js2-INSTANCEOF "instanceof") (cons js2-DELPROP "delete") (cons js2-AWAIT "await") + (cons js2-VOID "void") (cons js2-COMMA ",") (cons js2-COLON ":") (cons js2-OR "||") @@ -3580,7 +3581,8 @@ property is added if the operator follows the operand." (insert op)) (if (or (= tt js2-TYPEOF) (= tt js2-DELPROP) - (= tt js2-AWAIT)) + (= tt js2-AWAIT) + (= tt js2-VOID)) (insert " ")) (js2-print-ast (js2-unary-node-operand n) 0) (when postfix diff --git a/tests/parser.el b/tests/parser.el index 50cb521ba..520ff45d1 100644 --- a/tests/parser.el +++ b/tests/parser.el @@ -126,6 +126,9 @@ the test." (js2-deftest-parse let-expression-statement "let (x = 42) x;") +(js2-deftest-parse void + "void 0;") + ;;; Callers of `js2-valid-prop-name-token' (js2-deftest-parse parse-property-access-when-not-keyword -- 2.39.2