Skip to content

Commit

Permalink
docs(transformer): fix comments (#7925)
Browse files Browse the repository at this point in the history
Fix comment. It was inaccurate previously.
  • Loading branch information
overlookmotel committed Dec 15, 2024
1 parent 02b653c commit 10a86b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/oxc_transformer/src/common/duplicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down

0 comments on commit 10a86b9

Please sign in to comment.