From 504e1e38a8724fc2439f405f0aa8274b58db7b1b Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 8 Nov 2011 10:12:39 +0400 Subject: [PATCH] Don't mark strict mode decl as having no side effects Fixes #21 --- js2-mode.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js2-mode.el b/js2-mode.el index fd2248b4..178d7c9d 100644 --- a/js2-mode.el +++ b/js2-mode.el @@ -4829,7 +4829,10 @@ You should use `js2-print-tree' instead of this function." ;; I'll wait for people to notice incorrect warnings. ((and (= tt js2-EXPR_VOID) (js2-expr-stmt-node-p node)) ; but not if EXPR_RESULT - (js2-node-has-side-effects (js2-expr-stmt-node-expr node))) + (let ((expr (js2-expr-stmt-node-expr node))) + (or (js2-node-has-side-effects expr) + (when (js2-string-node-p expr) + (string= "use strict" (js2-string-node-value expr)))))) ((= tt js2-COMMA) (js2-node-has-side-effects (js2-infix-node-right node))) ((or (= tt js2-AND)