mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
refactor(transformer): duplicate_expression do not produce temp var for super (#7757)
`TransformCtx::duplicate_expression` method introduced in #7754 don't create a temp var for `super`. This prepares it for use in logical assignment operator transform (#7745).
This commit is contained in:
parent
a750ebc324
commit
9c2a1b61b9
1 changed files with 6 additions and 1 deletions
|
|
@ -109,11 +109,16 @@ impl<'a> TransformCtx<'a> {
|
|||
|
||||
self.var_declarations.create_uid_var(&ident.name, ctx)
|
||||
}
|
||||
// Reading `this` or `super` cannot have side effects, so no need for temp var
|
||||
Expression::ThisExpression(this) => {
|
||||
// Reading `this` cannot have side effects, so no need for temp var
|
||||
let references = create_array(|| ctx.ast.expression_this(this.span));
|
||||
return (expr, references);
|
||||
}
|
||||
Expression::Super(super_expr) => {
|
||||
let references = create_array(|| ctx.ast.expression_super(super_expr.span));
|
||||
return (expr, references);
|
||||
}
|
||||
// Anything else requires temp var
|
||||
_ => self.var_declarations.create_uid_var_based_on_node(&expr, ctx),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue