Skip to content

Commit b99312a

Browse files
committed
improve side effect detection for tagged templates
1 parent 9cb4abe commit b99312a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

jscomp/core/js_analyzer.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ let rec no_side_effect_expression_desc (x : J.expression_desc) =
103103
| String_append (a, b) | Seq (a, b) -> no_side_effect a && no_side_effect b
104104
| Length (e, _) | Caml_block_tag (e, _) | Typeof e -> no_side_effect e
105105
| Bin (op, a, b) -> op <> Eq && no_side_effect a && no_side_effect b
106-
| Tagged_template (_call_expr, _strings, values) -> Ext_list.for_all values no_side_effect
106+
| Tagged_template (call_expr, strings, values) -> no_side_effect call_expr &&
107+
Ext_list.for_all strings no_side_effect && Ext_list.for_all values no_side_effect
107108
| Js_not _ | Cond _ | FlatCall _ | Call _ | New _ | Raw_js_code _
108109
(* actually true? *) ->
109110
false

0 commit comments

Comments
 (0)