From ee6a73ff2a34a370d50a6a4d82ed1258f8647f90 Mon Sep 17 00:00:00 2001 From: Dunqing Date: Wed, 25 Dec 2024 16:57:32 +0800 Subject: [PATCH] feat(transformer/class-properties): transform super expressions and identifiers that refers to class binding in private method --- .../es2022/class_properties/private_method.rs | 91 ++++++++++++++++++- .../static_block_and_prop_init.rs | 2 +- .../class_properties/super_converter.rs | 57 +++++++++--- .../src/es2022/class_properties/utils.rs | 10 ++ .../snapshots/babel.snap.md | 7 +- .../snapshots/babel_exec.snap.md | 84 +++++++++-------- 6 files changed, 189 insertions(+), 62 deletions(-) diff --git a/crates/oxc_transformer/src/es2022/class_properties/private_method.rs b/crates/oxc_transformer/src/es2022/class_properties/private_method.rs index 4d3a2f005e5c0..3f7d78395fd64 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/private_method.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/private_method.rs @@ -1,14 +1,17 @@ //! ES2022: Class Properties //! Transform of private method uses e.g. `this.#method()`. -use oxc_ast::ast::{Argument, Expression, FunctionType, MethodDefinition, PropertyKey, Statement}; +use oxc_ast::{ast::*, visit::walk_mut, VisitMut}; use oxc_semantic::ScopeFlags; use oxc_span::SPAN; use oxc_traverse::TraverseCtx; use crate::Helper; -use super::ClassProperties; +use super::{ + super_converter::{ClassPropertiesSuperConverter, ClassPropertiesSuperConverterMode}, + ClassProperties, +}; impl<'a, 'ctx> ClassProperties<'a, 'ctx> { /// Convert method definition where the key is a private identifier and @@ -47,10 +50,17 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { function.id = Some(temp_binding.create_binding_identifier(ctx)); function.r#type = FunctionType::FunctionDeclaration; + // Change parent scope of function to current scope id and remove + // strict mode flag if parent scope is not strict mode. let scope_id = function.scope_id(); - let new_parent_id = ctx.current_block_scope_id(); + let new_parent_id = ctx.current_scope_id(); ctx.scopes_mut().change_parent_id(scope_id, Some(new_parent_id)); - *ctx.scopes_mut().get_flags_mut(scope_id) -= ScopeFlags::StrictMode; + if !ctx.current_scope_flags().is_strict_mode() { + *ctx.scopes_mut().get_flags_mut(scope_id) -= ScopeFlags::StrictMode; + } + + PrivateMethodVisitor::new(method.r#static, self, ctx) + .visit_function(&mut function, ScopeFlags::Function); let function = ctx.ast.alloc(function); self.insert_after_stmts.push(Statement::FunctionDeclaration(function)); @@ -71,3 +81,76 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { self.ctx.helper_call_expr(Helper::ClassPrivateMethodInitSpec, SPAN, arguments, ctx) } } + +/// Visitor to transform: +/// +/// Almost the same as `super::static_block_and_prop_init::StaticVisitor`, +/// but only does following: +/// +/// 1. Reference to class name to class temp var. +/// 2. Transform `super` expressions. +struct PrivateMethodVisitor<'a, 'ctx, 'v> { + super_converter: ClassPropertiesSuperConverter<'a, 'ctx, 'v>, + /// `TraverseCtx` object. + ctx: &'v mut TraverseCtx<'a>, +} + +impl<'a, 'ctx, 'v> PrivateMethodVisitor<'a, 'ctx, 'v> { + fn new( + r#static: bool, + class_properties: &'v mut ClassProperties<'a, 'ctx>, + ctx: &'v mut TraverseCtx<'a>, + ) -> Self { + let mode = if r#static { + ClassPropertiesSuperConverterMode::StaticPrivateMethod + } else { + ClassPropertiesSuperConverterMode::PrivateMethod + }; + Self { super_converter: ClassPropertiesSuperConverter::new(mode, class_properties), ctx } + } +} + +impl<'a, 'ctx, 'v> VisitMut<'a> for PrivateMethodVisitor<'a, 'ctx, 'v> { + #[inline] + fn visit_expression(&mut self, expr: &mut Expression<'a>) { + match expr { + // `super.prop` + Expression::StaticMemberExpression(_) => { + self.super_converter.transform_static_member_expression(expr, self.ctx); + } + // `super[prop]` + Expression::ComputedMemberExpression(_) => { + self.super_converter.transform_computed_member_expression(expr, self.ctx); + } + // `super.prop()` + Expression::CallExpression(call_expr) => { + self.super_converter + .transform_call_expression_for_super_member_expr(call_expr, self.ctx); + } + // `super.prop = value`, `super.prop += value`, `super.prop ??= value` + Expression::AssignmentExpression(_) => { + self.super_converter + .transform_assignment_expression_for_super_assignment_target(expr, self.ctx); + } + // `super.prop++`, `--super.prop` + Expression::UpdateExpression(_) => { + self.super_converter + .transform_update_expression_for_super_assignment_target(expr, self.ctx); + } + _ => {} + } + walk_mut::walk_expression(self, expr); + } + + /// Transform reference to class name to temp var + fn visit_identifier_reference(&mut self, ident: &mut IdentifierReference<'a>) { + self.super_converter.class_properties.replace_class_name_with_temp_var(ident, self.ctx); + } + + #[inline] + fn visit_class(&mut self, _class: &mut Class<'a>) { + // Ignore because we don't need to transform `super` for other classes. + } +} + +impl<'a, 'ctx, 'v> PrivateMethodVisitor<'a, 'ctx, 'v> {} diff --git a/crates/oxc_transformer/src/es2022/class_properties/static_block_and_prop_init.rs b/crates/oxc_transformer/src/es2022/class_properties/static_block_and_prop_init.rs index 89c353e672b14..e09104e9afed6 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/static_block_and_prop_init.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/static_block_and_prop_init.rs @@ -109,7 +109,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> { } /// Replace reference to class name with reference to temp var for class. - fn replace_class_name_with_temp_var( + pub(super) fn replace_class_name_with_temp_var( &mut self, ident: &mut IdentifierReference<'a>, ctx: &mut TraverseCtx<'a>, diff --git a/crates/oxc_transformer/src/es2022/class_properties/super_converter.rs b/crates/oxc_transformer/src/es2022/class_properties/super_converter.rs index c6735c5387c0e..d0374b83c25df 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/super_converter.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/super_converter.rs @@ -8,17 +8,23 @@ use oxc_traverse::{ast_operations::get_var_name_from_node, TraverseCtx}; use crate::Helper; -use super::{utils::create_assignment, ClassProperties}; +use super::{ + utils::{create_assignment, create_prototype_member}, + ClassProperties, +}; #[derive(Debug)] pub(super) enum ClassPropertiesSuperConverterMode { // `static prop` or `static {}` Static, + // `#method() {}` + PrivateMethod, + // `static #method() {}` + StaticPrivateMethod, } /// Convert `super` expressions. pub(super) struct ClassPropertiesSuperConverter<'a, 'ctx, 'v> { - #[expect(unused)] mode: ClassPropertiesSuperConverterMode, pub(super) class_properties: &'v mut ClassProperties<'a, 'ctx>, } @@ -557,20 +563,16 @@ impl<'a, 'ctx, 'v> ClassPropertiesSuperConverter<'a, 'ctx, 'v> { is_callee: bool, ctx: &mut TraverseCtx<'a>, ) -> Expression<'a> { - let temp_binding = - self.class_properties.current_class_mut().bindings.get_or_init_static_binding(ctx); - - let ident1 = Argument::from(temp_binding.create_read_expression(ctx)); - let ident2 = Argument::from(temp_binding.create_read_expression(ctx)); + let (class, receiver) = self.get_class_binding_arguments(ctx); let property = Argument::from(property); let arguments = if is_callee { // `(_Class, prop, _Class, 2)` let two = ctx.ast.expression_numeric_literal(SPAN, 2.0, None, NumberBase::Decimal); - ctx.ast.vec_from_array([ident1, property, ident2, Argument::from(two)]) + ctx.ast.vec_from_array([class, property, receiver, Argument::from(two)]) } else { // `(_Class, prop, _Class)` - ctx.ast.vec_from_array([ident1, property, ident2]) + ctx.ast.vec_from_array([class, property, receiver]) }; // `_superPropGet(_Class, prop, _Class)` or `_superPropGet(_Class, prop, _Class, 2)` @@ -585,13 +587,12 @@ impl<'a, 'ctx, 'v> ClassPropertiesSuperConverter<'a, 'ctx, 'v> { value: Expression<'a>, ctx: &mut TraverseCtx<'a>, ) -> Expression<'a> { - let temp_binding = - self.class_properties.current_class_mut().bindings.get_or_init_static_binding(ctx); + let (class, receiver) = self.get_class_binding_arguments(ctx); let arguments = ctx.ast.vec_from_array([ - Argument::from(temp_binding.create_read_expression(ctx)), + class, Argument::from(property), Argument::from(value), - Argument::from(temp_binding.create_read_expression(ctx)), + receiver, Argument::from(ctx.ast.expression_numeric_literal( SPAN, 1.0, @@ -601,4 +602,34 @@ impl<'a, 'ctx, 'v> ClassPropertiesSuperConverter<'a, 'ctx, 'v> { ]); self.class_properties.ctx.helper_call_expr(Helper::SuperPropSet, span, arguments, ctx) } + + /// * [`ClassPropertiesSuperConverterMode::Static`] + /// (_Class, _Class) + /// + /// * [`ClassPropertiesSuperConverterMode::PrivateMethod`] + /// (_Class.prototype, this) + /// + /// * [`ClassPropertiesSuperConverterMode::StaticPrivateMethod`] + /// (_Class, this) + fn get_class_binding_arguments( + &mut self, + ctx: &mut TraverseCtx<'a>, + ) -> (Argument<'a>, Argument<'a>) { + let temp_binding = + self.class_properties.current_class_mut().bindings.get_or_init_static_binding(ctx); + let mut class = temp_binding.create_read_expression(ctx); + let receiver = match self.mode { + ClassPropertiesSuperConverterMode::Static => temp_binding.create_read_expression(ctx), + ClassPropertiesSuperConverterMode::PrivateMethod => { + // TODO(improve-on-babel): `superPropGet` and `superPropSet` helper function has a flag + // to use `class.prototype` rather than `class`. We should consider using that flag here. + // + class = create_prototype_member(class, ctx); + ctx.ast.expression_this(SPAN) + } + ClassPropertiesSuperConverterMode::StaticPrivateMethod => ctx.ast.expression_this(SPAN), + }; + + (Argument::from(class), Argument::from(receiver)) + } } diff --git a/crates/oxc_transformer/src/es2022/class_properties/utils.rs b/crates/oxc_transformer/src/es2022/class_properties/utils.rs index be9c50d54220b..55f2c0188c302 100644 --- a/crates/oxc_transformer/src/es2022/class_properties/utils.rs +++ b/crates/oxc_transformer/src/es2022/class_properties/utils.rs @@ -71,3 +71,13 @@ pub(super) fn debug_assert_expr_is_not_parenthesis_or_typescript_syntax( "Should not be: {expr:?} in {path:?}", ); } + +/// `object` -> `object.prototype`. +pub(super) fn create_prototype_member<'a>( + object: Expression<'a>, + ctx: &mut TraverseCtx<'a>, +) -> Expression<'a> { + let property = ctx.ast.identifier_name(SPAN, Atom::from("prototype")); + let static_member = ctx.ast.member_expression_static(SPAN, object, property, false); + Expression::from(static_member) +} diff --git a/tasks/transform_conformance/snapshots/babel.snap.md b/tasks/transform_conformance/snapshots/babel.snap.md index 61a78ae3bb6fb..53dea0aad032c 100644 --- a/tasks/transform_conformance/snapshots/babel.snap.md +++ b/tasks/transform_conformance/snapshots/babel.snap.md @@ -1,6 +1,6 @@ commit: 54a8389f -Passed: 630/1095 +Passed: 631/1095 # All Passed: * babel-plugin-transform-logical-assignment-operators @@ -462,7 +462,7 @@ x Output mismatch x Output mismatch -# babel-plugin-transform-private-methods (15/148) +# babel-plugin-transform-private-methods (16/148) * accessors/arguments/input.js x Output mismatch @@ -565,9 +565,6 @@ x Output mismatch * misc/multiple/input.js x Output mismatch -* private-method/class-binding/input.js -x Output mismatch - * private-method/class-expression/input.js x Output mismatch diff --git a/tasks/transform_conformance/snapshots/babel_exec.snap.md b/tasks/transform_conformance/snapshots/babel_exec.snap.md index dfa25e1d77817..e5737b715b30e 100644 --- a/tasks/transform_conformance/snapshots/babel_exec.snap.md +++ b/tasks/transform_conformance/snapshots/babel_exec.snap.md @@ -2,7 +2,7 @@ commit: 54a8389f node: v22.12.0 -Passed: 227 of 362 (62.71%) +Passed: 231 of 362 (63.81%) Failures: @@ -129,7 +129,7 @@ Private field '#privateFieldValue' must be declared in an enclosing class ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-class-binding-exec.test.js AssertionError: expected [Function _get_getA] to be [Function A] // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-class-binding-exec.test.js:20:26 + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-class-binding-exec.test.js:22:26 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-get-only-setter-exec.test.js AssertionError: expected function to throw an error, but it didn't @@ -144,8 +144,8 @@ Private field '#privateFieldValue' must be declared in an enclosing class ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-class-binding-exec.test.js ReferenceError: _A_brand is not defined - at new A (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-class-binding-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-class-binding-exec.test.js:19:9 + at new A (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-class-binding-exec.test.js:9:38) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-class-binding-exec.test.js:21:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-loose-get-only-setter-exec.test.js ReferenceError: _Cl_brand is not defined @@ -169,8 +169,8 @@ Private field '#privateFieldValue' must be declared in an enclosing class ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-class-binding-exec.test.js ReferenceError: _A_brand is not defined - at new A (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-class-binding-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-class-binding-exec.test.js:19:9 + at new A (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-class-binding-exec.test.js:9:38) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-class-binding-exec.test.js:21:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsProperties-get-only-setter-exec.test.js ReferenceError: _Cl_brand is not defined @@ -191,7 +191,7 @@ Private field '#privateFieldValue' must be declared in an enclosing class ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-class-binding-exec.test.js AssertionError: expected [Function _get_getA] to be [Function A] // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-class-binding-exec.test.js:20:26 + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-class-binding-exec.test.js:22:26 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-privateFieldsAsSymbols-get-only-setter-exec.test.js AssertionError: expected [Function _set_privateFieldValue] to be undefined @@ -222,10 +222,6 @@ Private field '#privateFieldValue' must be declared in an enclosing class ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-accessors-updates-exec.test.js Private field '#privateFieldValue' must be declared in an enclosing class -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-class-binding-exec.test.js -AssertionError: expected null to be [Function A] // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-class-binding-exec.test.js:20:28 - ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-context-exec.test.js Private field '#getStatus' must be declared in an enclosing class @@ -241,8 +237,8 @@ ReferenceError: _Cl_brand is not defined ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-class-binding-exec.test.js ReferenceError: _A_brand is not defined - at new A (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-class-binding-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-class-binding-exec.test.js:19:9 + at new A (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-class-binding-exec.test.js:9:38) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-class-binding-exec.test.js:21:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-context-exec.test.js Private field '#getStatus' must be declared in an enclosing class @@ -261,7 +257,9 @@ ReferenceError: _Cl_brand is not defined Private field '#privateMethod' must be declared in an enclosing class ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-super-exec.test.js -Invalid access to super +ReferenceError: _Sub_brand is not defined + at new Sub (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-super-exec.test.js:16:38) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-loose-super-exec.test.js:29:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-assignment-exec.test.js ReferenceError: _Foo_brand is not defined @@ -275,8 +273,8 @@ ReferenceError: _Cl_brand is not defined ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-class-binding-exec.test.js ReferenceError: _A_brand is not defined - at new A (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-class-binding-exec.test.js:8:38) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-class-binding-exec.test.js:19:9 + at new A (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-class-binding-exec.test.js:9:38) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-class-binding-exec.test.js:21:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-context-exec.test.js Private field '#getStatus' must be declared in an enclosing class @@ -292,27 +290,19 @@ ReferenceError: _Cl_brand is not defined at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-generator-exec.test.js:18:14 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-super-exec.test.js -Invalid access to super - -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsSymbols-class-binding-exec.test.js -AssertionError: expected null to be [Function A] // Object.is equality - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsSymbols-class-binding-exec.test.js:20:28 +ReferenceError: _Sub_brand is not defined + at new Sub (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-super-exec.test.js:16:38) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsProperties-super-exec.test.js:29:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsSymbols-context-exec.test.js Private field '#getStatus' must be declared in an enclosing class -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-privateFieldsAsSymbols-super-exec.test.js -Invalid access to super - ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-read-only-exec.test.js Private field '#method' must be declared in an enclosing class ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-reassignment-exec.test.js Private field '#privateFieldValue' must be declared in an enclosing class -./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-method-super-exec.test.js -Invalid access to super - ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-basic-exec.test.js ReferenceError: _Cl_brand is not defined at new Cl (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-basic-exec.test.js:21:38) @@ -362,10 +352,14 @@ ReferenceError: _Cl_brand is not defined at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-scopable-exec.test.js:22:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-super-exec.test.js -Invalid access to super +ReferenceError: _Sub_brand is not defined + at Function.check (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-super-exec.test.js:22:29) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-super-exec.test.js:29:13 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-this-exec.test.js -Invalid access to super +ReferenceError: _B_brand is not defined + at Function.extract (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-this-exec.test.js:22:30) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-loose-this-exec.test.js:32:25 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-basic-exec.test.js ReferenceError: _Cl_brand is not defined @@ -396,10 +390,14 @@ ReferenceError: _Cl_brand is not defined at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-scopable-exec.test.js:22:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-super-exec.test.js -Invalid access to super +ReferenceError: _Sub_brand is not defined + at Function.check (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-super-exec.test.js:22:29) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-super-exec.test.js:29:13 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-this-exec.test.js -Invalid access to super +ReferenceError: _B_brand is not defined + at Function.extract (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-this-exec.test.js:22:30) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsProperties-this-exec.test.js:32:25 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-basic-exec.test.js ReferenceError: _Cl_brand is not defined @@ -430,10 +428,14 @@ ReferenceError: _Cl_brand is not defined at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-scopable-exec.test.js:22:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-super-exec.test.js -Invalid access to super +ReferenceError: _Sub_brand is not defined + at Function.check (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-super-exec.test.js:22:29) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-super-exec.test.js:29:13 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-this-exec.test.js -Invalid access to super +ReferenceError: _B_brand is not defined + at Function.extract (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-this-exec.test.js:22:30) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-privateFieldsAsSymbols-this-exec.test.js:32:25 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-read-only-exec.test.js Private field '#method' must be declared in an enclosing class @@ -447,7 +449,9 @@ ReferenceError: _Cl_brand is not defined at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-scopable-exec.test.js:22:9 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-super-exec.test.js -Invalid access to super +ReferenceError: _Sub_brand is not defined + at Function.check (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-super-exec.test.js:22:29) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-super-exec.test.js:29:13 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-tagged-template-exec.test.js ReferenceError: _Foo_brand is not defined @@ -455,7 +459,9 @@ ReferenceError: _Foo_brand is not defined at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-tagged-template-exec.test.js:17:13 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-this-exec.test.js -Invalid access to super +ReferenceError: _B_brand is not defined + at Function.extract (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-this-exec.test.js:22:30) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-private-static-method-this-exec.test.js:32:25 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-access-in-static-field-initializer-exec.test.js Private field '#p' must be declared in an enclosing class @@ -482,8 +488,8 @@ Private field '#p' must be declared in an enclosing class ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-get-only-setter-exec.test.js ReferenceError: _Cl_brand is not defined - at Function.getPrivateStaticFieldValue (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-get-only-setter-exec.test.js:14:29) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-get-only-setter-exec.test.js:24:12 + at Function.getPrivateStaticFieldValue (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-get-only-setter-exec.test.js:15:29) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-get-only-setter-exec.test.js:26:12 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-loose-set-only-getter-exec.test.js Private field '#privateFieldValue' must be declared in an enclosing class @@ -502,8 +508,8 @@ Private field '#p' must be declared in an enclosing class ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-get-only-setter-exec.test.js ReferenceError: _Cl_brand is not defined - at Function.getPrivateStaticFieldValue (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-get-only-setter-exec.test.js:14:29) - at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-get-only-setter-exec.test.js:24:12 + at Function.getPrivateStaticFieldValue (./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-get-only-setter-exec.test.js:15:29) + at ./tasks/transform_conformance/fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-get-only-setter-exec.test.js:26:12 ./fixtures/babel/babel-plugin-transform-private-methods-test-fixtures-static-accessors-privateFieldsAsProperties-set-only-getter-exec.test.js Private field '#privateFieldValue' must be declared in an enclosing class