Skip to content

Commit 2c8208c

Browse files
committed
fix side effect detection for tagged templates
1 parent 13c41e5 commit 2c8208c

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

jscomp/core/js_analyzer.ml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,7 @@ 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-
(*
107-
TODO: we should check look at each of the expressions in the 'values' list/array
108-
to determine if any of them have side-effects. For now we'll just return false
109-
to make the compiler happy.
110-
*)
111-
| Tagged_template _ -> false
106+
| Tagged_template (_call_expr, _strings, values) -> Ext_list.for_all values no_side_effect
112107
| Js_not _ | Cond _ | FlatCall _ | Call _ | New _ | Raw_js_code _
113108
(* actually true? *) ->
114109
false

0 commit comments

Comments
 (0)