Skip to content

Commit

Permalink
Don't mark strict mode decl as having no side effects
Browse files Browse the repository at this point in the history
Fixes mooz#21
  • Loading branch information
dgutov committed Nov 8, 2011
1 parent 0e0362b commit 504e1e3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion js2-mode.el
Expand Up @@ -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)
Expand Down

0 comments on commit 504e1e3

Please sign in to comment.