branch: master
commit d1bf11f83df6b1824ac958b1ec827c5e1d6dfae7
Author: Jackson Hamilton <[email protected]>
Commit: Jackson Hamilton <[email protected]>
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 f574aee..85c3ee9 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 50cb521..520ff45 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