mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
docs(transformer): clarify comment (#7918)
This commit is contained in:
parent
1317c00a5d
commit
f4cb5d3c95
1 changed files with 5 additions and 1 deletions
|
|
@ -122,7 +122,11 @@ impl<'a> TransformCtx<'a> {
|
|||
let references = create_array(|| expr.clone_in(ctx.ast.allocator));
|
||||
return (expr, references);
|
||||
}
|
||||
// Template literal can have no side effects if it has no expressions
|
||||
// Template literal cannot have side effects if it has no expressions.
|
||||
// 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.
|
||||
Expression::TemplateLiteral(lit) if lit.expressions.is_empty() => {
|
||||
let references = create_array(|| {
|
||||
ctx.ast.expression_template_literal(
|
||||
|
|
|
|||
Loading…
Reference in a new issue