diff --git a/crates/oxc_transformer/src/es2022/class_properties/private.rs b/crates/oxc_transformer/src/es2022/class_properties/private.rs index 4b6ca6ce57a671..f66f4968ad6407 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/private.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/private.rs @@ -145,6 +145,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { unreachable!() }; + // TODO: Should never be `None` - only because implementation is incomplete. let Some((callee, object)) = self.transform_private_field_callee(field_expr, ctx) else { return; }; @@ -162,15 +163,23 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { /// Transform [`CallExpression::callee`] or [`TaggedTemplateExpression::tag`] that is a private field. /// - /// Return two expressions for `callee` and `object`, respectively. + /// Returns two expressions for `callee` and `object`: /// - /// * this.#method - /// callee: `_classPrivateFieldGet(_method, this)` - /// object: `this` + /// Instance prop: + /// * `this.#prop` -> + /// callee: `_classPrivateFieldGet(_prop, this)` + /// object: `this` + /// * `this.obj.#prop` -> + /// callee: `_classPrivateFieldGet(_prop, _this$obj = this.obj);` + /// object: `_this$obj` /// - /// * this.obj.#method - /// callee: `_classPrivateFieldGet(_method, _this$obj = this.obj);` - /// object: `_this$obj` + /// Static prop: + /// * `this.#prop` -> + /// callee: `_assertClassBrand(Class, this, _prop)._` + /// object: `this` + /// * `this.obj.#prop` -> + /// callee: `_assertClassBrand(Class, (_this$obj = this.obj), _prop)._` + /// object: `_this$obj` fn transform_private_field_callee( &mut self, field_expr: &mut PrivateFieldExpression<'a>,