Skip to content

Commit 814eab6

Browse files
Boshensapphi-red
andauthored
refactor(minifier): Math.pow(a,b) -> a ** (+b) instead of (+a) ** (+b) (#9154)
It's currently minifying twice through: `Math.pow(a, b)` -> `(+a) ** (+b)` -> `a ** (+b)` --------- Co-authored-by: 翠 / green <green@sapphi.red>
1 parent 9e3571f commit 814eab6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/oxc_minifier/src/peephole/replace_known_methods.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@ impl<'a> PeepholeOptimizations {
392392

393393
Some(ctx.ast.expression_binary(
394394
span,
395-
wrap_with_unary_plus_if_needed(first_arg),
395+
// see [`PeepholeOptimizations::is_binary_operator_that_does_number_conversion`] why it does not require `wrap_with_unary_plus_if_needed` here
396+
ctx.ast.move_expression(first_arg),
396397
BinaryOperator::Exponential,
397398
wrap_with_unary_plus_if_needed(second_arg),
398399
))

0 commit comments

Comments
 (0)