diff --git a/crates/oxc_transformer/src/es2016/exponentiation_operator.rs b/crates/oxc_transformer/src/es2016/exponentiation_operator.rs index 08e283cab37d1..39dbd68abec68 100644 --- a/crates/oxc_transformer/src/es2016/exponentiation_operator.rs +++ b/crates/oxc_transformer/src/es2016/exponentiation_operator.rs @@ -1,3 +1,35 @@ +//! ES2016: Exponentiation Operator +//! +//! This plugin transforms the exponentiation operator (`**`) to `Math.pow`. +//! +//! > This plugin is included in `preset-env`, in ES2016 +//! +//! ## Example +//! +//! Input: +//! ```js +//! let x = 10 ** 2; +//! +//! x **= 3; +//! ``` +//! +//! Output: +//! ```js +//! let x = Math.pow(10, 2); +//! +//! x = Math.pow(x, 3); +//! ``` +//! +//! ## Implementation +//! +//! Implementation based on [@babel/plugin-transform-exponentiation-operator](https://babel.dev/docs/babel-plugin-transform-exponentiation-operator). +//! +//! ## References: +//! +//! * Babel plugin implementation: +//! * Exponentiation operator TC39 proposal: +//! * Exponentiation operator specification: + use std::cell::Cell; use oxc_allocator::{CloneIn, Vec};