branch: master commit 2c459c633d0d1c031c857fb547c35891c97e0d81 Merge: 890cf81 867919e Author: Dmitry Gutov <dgu...@yandex.ru> Commit: GitHub <nore...@github.com>
Merge pull request #436 from felipeochoa/issue429 Always consider `await` to have side-effects --- js2-mode.el | 3 +-- tests/parser.el | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js2-mode.el b/js2-mode.el index dca862a..3877105 100644 --- a/js2-mode.el +++ b/js2-mode.el @@ -5173,8 +5173,7 @@ You should use `js2-print-tree' instead of this function." (or (js2-node-has-side-effects expr) (when (js2-string-node-p expr) (member (js2-string-node-value expr) '("use strict" "use asm")))))) - ((= tt js2-AWAIT) - (js2-node-has-side-effects (js2-unary-node-operand node))) + ((= tt js2-AWAIT) t) ((= tt js2-COMMA) (js2-node-has-side-effects (js2-infix-node-right node))) ((or (= tt js2-AND) diff --git a/tests/parser.el b/tests/parser.el index c81ac0b..482ec8f 100644 --- a/tests/parser.el +++ b/tests/parser.el @@ -1295,3 +1295,8 @@ the test." (let ((js2-instanceof-has-side-effects t)) (js2-mode--and-parse) (should (null js2-parsed-warnings)))) + +(js2-deftest await-has-side-effects + "const p = new Promise();\nasync function f() { await p; return null; }" + (js2-mode--and-parse) + (should (null js2-parsed-warnings)))