docs(transformer): fix comments (#7925)

Fix comment. It was inaccurate previously.
This commit is contained in:
overlookmotel 2024-12-15 22:42:36 +00:00
parent 02b653c061
commit 10a86b9242
2 changed files with 2 additions and 2 deletions

View file

@ -126,7 +126,7 @@ impl<'a> TransformCtx<'a> {
// If it *does* have expressions, but they're all literals, then also cannot have side effects,
// but don't bother checking for that as it shouldn't occur in real world code.
// Why would you write "`x${9}z`" when you can just write "`x9z`"?
// Note: "`x${foo}`" *can* have side effects if `foo` is an object with a `valueOf` method.
// Note: "`x${foo}`" *can* have side effects if `foo` is an object with a `toString` method.
Expression::TemplateLiteral(lit) if lit.expressions.is_empty() => {
let references = create_array(|| {
ctx.ast.expression_template_literal(

View file

@ -116,7 +116,7 @@ fn key_needs_temp_var(key: &Expression, ctx: &TraverseCtx) -> bool {
// If it *does* have expressions, but they're all literals, then also cannot have side effects,
// but don't bother checking for that as it shouldn't occur in real world code.
// Why would you write "`x${9}z`" when you can just write "`x9z`"?
// Note: "`x${foo}`" *can* have side effects if `foo` is an object with a `valueOf` method.
// Note: "`x${foo}`" *can* have side effects if `foo` is an object with a `toString` method.
Expression::TemplateLiteral(lit) => !lit.expressions.is_empty(),
// `IdentifierReference`s can have side effects if is unbound.
//