Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl MayHaveSideEffects for TemplateLiteral<'_> {
// If the expression is a Symbol or ToPrimitive returns a Symbol, an error is thrown.
// ToPrimitive returns the value as-is for non-Object values, so we can use it instead of ToString here.
e.to_primitive(is_global_reference).is_symbol() != Some(false)
|| e.may_have_side_effects(is_global_reference)
})
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ fn test_template_literal() {
test("`${{ [s]() { console.log('sideeffect') } }}`", true); // assuming s is Symbol.toPrimitive
test("`${a}`", true); // a maybe a symbol
test("`${a()}`", true);
test("`${a() === b}`", true);
}

#[test]
Expand Down
Loading