Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Nov 27, 2024
1 parent 771ae84 commit f11f2a6
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions crates/oxc_transformer/src/es2022/class_properties/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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>,
Expand Down

0 comments on commit f11f2a6

Please sign in to comment.