Repository: babel/babel (TypeScript)

Issue:
[Bug]: Decorators | Error when calling `super` in constructor of extended class when decorating accessors.
### 💻

- [ ] Would you like to work on a fix?

### How are you using Babel?

@babel/register or @babel/node

### Input code

[Babel REPL Repro](https://babeljs.io/repl#?browsers=es2022&build=&builtIns=false&corejs=3.21&spec=false&loose=false&code_lz=GYVwdgxgLglg9mABAEwKYTgJwIZVQCgEpEBvAKEUU1ShEyVElgUXym0wHMaAaRDMHgAeUYiQC-ZSWQgAbbAGcFiACqoFUUhUQABNBhx4i27BAjqFWRMDhxEAXkQAWAEwBuMtoEbMIaFiItSgBIbzhZVAA6WThOfAByAAtUWRj4wg9KSWkwVAB3VXUoYxl5JUKNAGFEmFlkRFQRVDBkZTUNIN19LFwCQhMzCysAIw4HRABGDy8EHz8oALFtSgUQAAdUTCJMxGzPb01McdyC9qhq2uRtoA&debug=false&forceAllTransforms=false&modules=commonjs&shippedProposals=false&circleciRepo=&evaluate=true&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=typescript&prettier=false&targets=&version=7.24.3&externalPlugins=%40babel%2Fplugin-proposal-decorators%407.24.1&assumptions=%7B%7D)

Throws the following error

```
/repl.ts: Cannot read properties of undefined (reading 'name')
```

```javascript
function decorate() {
  return function (target, context) {}
}

class Test {
  @decorate()
  accessor foo = 42;

  constructor() {
  	console.log('hello');
  }
}

new Test()

class TestChild extends Test {
  @decorate()
  accessor bar = 1;

  constructor() {
    super();
  }
}

const r = new TestChild();
```

### Configuration file name

babel.config.json

### Configuration

```json
{
  "$schema": "https://json.schemastore.org/babelrc.json",
  "plugins": [["@babel/plugin-proposal-decorators", { "version": "2023-11" }]],
  "presets": [
    ["@babel/preset-env", { "targets": { "node": "current" } }],
    "@babel/preset-typescript"
  ]
}

```

### Current and expected behavior

Expected Behavior: Code compiles without issue
Actual Behavior: Error

### Environment

- Babel Version `7.24.1`
- Environment: REPL & Node v20.10 

### Possible solution

_No response_

### Additional context

_No response_


Hints:
Hey @jkonowitch! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant [Slack community](https://babeljs.slack.com) that typically always has someone willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite.
This for me in the REPL throws "t is undefined" and fails transpiling, which is even worse than a wrong output. Thanks for the report!

Patch:
diff --git a/packages/babel-helper-create-class-features-plugin/src/decorators.ts b/packages/babel-helper-create-class-features-plugin/src/decorators.ts
--- a/packages/babel-helper-create-class-features-plugin/src/decorators.ts
+++ b/packages/babel-helper-create-class-features-plugin/src/decorators.ts
@@ -475,26 +475,28 @@ function optimizeSuperCallAndExpressions(
   expressions: t.Expression[],
   protoInitLocal: t.Identifier,
 ) {
-  // Merge `super(), protoInit(this)` into `protoInit(super())`
-  if (
-    expressions.length >= 2 &&
-    isProtoInitCallExpression(expressions[1], protoInitLocal)
-  ) {
-    const mergedSuperCall = t.callExpression(t.cloneNode(protoInitLocal), [
-      expressions[0],
-    ]);
-    expressions.splice(0, 2, mergedSuperCall);
-  }
-  // Merge `protoInit(super()), this` into `protoInit(super())`
-  if (
-    expressions.length >= 2 &&
-    t.isThisExpression(expressions[expressions.length - 1]) &&
-    isProtoInitCallExpression(
-      expressions[expressions.length - 2],
-      protoInitLocal,
-    )
-  ) {
-    expressions.splice(expressions.length - 1, 1);
+  if (protoInitLocal) {
+    if (
+      expressions.length >= 2 &&
+      isProtoInitCallExpression(expressions[1], protoInitLocal)
+    ) {
+      // Merge `super(), protoInit(this)` into `protoInit(super())`
+      const mergedSuperCall = t.callExpression(t.cloneNode(protoInitLocal), [
+        expressions[0],
+      ]);
+      expressions.splice(0, 2, mergedSuperCall);
+    }
+    // Merge `protoInit(super()), this` into `protoInit(super())`
+    if (
+      expressions.length >= 2 &&
+      t.isThisExpression(expressions[expressions.length - 1]) &&
+      isProtoInitCallExpression(
+        expressions[expressions.length - 2],
+        protoInitLocal,
+      )
+    ) {
+      expressions.splice(expressions.length - 1, 1);
+    }
   }
   return maybeSequenceExpression(expressions);
 }


Test patch:
diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initField-existing-derived-constructor/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initField-existing-derived-constructor/exec.js
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initField-existing-derived-constructor/exec.js
@@ -0,0 +1,175 @@
+{
+  let self, a, initCalled;
+
+  function deco(_, context) {
+    context.addInitializer(() => {
+      initCalled = true;
+    });
+  }
+
+  class B {
+    constructor(s) {
+      a = s;
+    }
+  }
+
+  class A extends B {
+    constructor() {
+      let a = 2;
+      self = super(a);
+    }
+
+    @deco
+    accessor foo = 42;
+  }
+
+  let instance = new A();
+  expect(self).toBe(instance);
+  expect(a).toBe(2);
+  expect(initCalled).toBe(true);
+}
+
+{
+  const dec = ({ get, set }) => {
+    return {
+      get() {
+        return get.call(this) + 100;
+      },
+
+      set(v) {
+        set.call(this, v);
+      },
+    }
+  };
+
+  class B {
+    constructor(v) {
+      this.a = v;
+    }
+    method() {
+      return this.a;
+    }
+  }
+
+  {
+    ("super() nested within another constructor should not be transformed");
+    let log = [];
+    class A extends B {
+      constructor() {
+        log.push(super(3).method());
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(4).method());
+          }
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("3,4");
+    expect(a.foo).toBe(142);
+  }
+
+  {
+    ("super() not in decorated derived constructor should not be transformed: computed key");
+    let log = [];
+    new (class Dummy extends B {
+      constructor() {
+        let key;
+        class A extends B {
+          constructor() {
+            log.push(super(6).method());
+          }
+
+          @dec
+          accessor foo = 42;
+
+          [((key = super(5).method()), log.push(key), key)];
+        }
+
+        const a = new A();
+
+        expect(a.foo).toBe(142);
+      }
+    })();
+
+    expect(log + "").toBe("5,6");
+  }
+
+  {
+    ("super() in decorator expression within decorated derived constructor should be transformed: decorator expression");
+    let log = [];
+    const noop = () => (fn) => fn;
+    new (class extends B {
+      constructor() {
+        class A extends B {
+          constructor() {
+            log.push(super(8).method());
+          }
+
+          @dec
+          accessor foo = 42;
+
+          @noop(log.push(super(7).method())) noop() {}
+        }
+
+        const a = new A();
+        expect(a.foo).toBe(142);
+      }
+    })();
+
+    expect(log + "").toBe("7,8");
+  }
+
+  {
+    ("super() within decorated derived constructor should be transformed: computed key");
+    let log = [];
+    class A extends B {
+      constructor() {
+        let key;
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(10).method());
+          }
+          [((key = super(9).method()), log.push(key), key)];
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("9,10");
+    expect(a.foo).toBe(142);
+  }
+
+  {
+    ("super() within decorated derived constructor should be transformed: decorator expression");
+    let log = [];
+    const noop = () => (fn) => fn;
+    class A extends B {
+      constructor() {
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(12).method());
+          }
+          @noop(log.push(super(11).method())) noop() {}
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("11,12");
+    expect(a.foo).toBe(142);
+  }
+}
diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initField-existing-derived-constructor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initField-existing-derived-constructor/input.js
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initField-existing-derived-constructor/input.js
@@ -0,0 +1,175 @@
+{
+  let self, a, initCalled;
+
+  function deco(_, context) {
+    context.addInitializer(() => {
+      initCalled = true;
+    });
+  }
+
+  class B {
+    constructor(s) {
+      a = s;
+    }
+  }
+
+  class A extends B {
+    constructor() {
+      let a = 2;
+      self = super(a);
+    }
+
+    @deco
+    accessor foo = 42;
+  }
+
+  let instance = new A();
+  expect(self).toBe(instance);
+  expect(a).toBe(2);
+  expect(initCalled).toBe(true);
+}
+
+{
+  const dec = ({ get, set }) => {
+    return {
+      get() {
+        return get.call(this) + 100;
+      },
+
+      set(v) {
+        set.call(this, v);
+      },
+    }
+  };
+
+  class B {
+    constructor(v) {
+      this.a = v;
+    }
+    method() {
+      return this.a;
+    }
+  }
+
+  {
+    ("super() nested within another constructor should not be transformed");
+    let log = [];
+    class A extends B {
+      constructor() {
+        log.push(super(3).method());
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(4).method());
+          }
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("3,4");
+    expect(a.foo).toBe(142);
+  }
+
+  {
+    ("super() not in decorated derived constructor should not be transformed: computed key");
+    let log = [];
+    new (class Dummy extends B {
+      constructor() {
+        let key;
+        class A extends B {
+          constructor() {
+            log.push(super(6).method());
+          }
+
+          @dec
+          accessor foo = 42;
+
+          [((key = super(5).method()), log.push(key), key)];
+        }
+
+        const a = new A();
+
+        expect(a.foo).toBe(142);
+      }
+    })();
+
+    expect(log + "").toBe("5,6");
+  }
+
+  {
+    ("super() in decorator expression within decorated derived constructor should be transformed: decorator expression");
+    let log = [];
+    const noop = () => (fn) => fn;
+    new (class extends B {
+      constructor() {
+        class A extends B {
+          constructor() {
+            log.push(super(8).method());
+          }
+
+          @dec
+          accessor foo = 42;
+
+          @noop(log.push(super(7).method())) noop() {}
+        }
+
+        const a = new A();
+        expect(a.foo).toBe(142);
+      }
+    })();
+
+    expect(log + "").toBe("7,8");
+  }
+
+  {
+    ("super() within decorated derived constructor should be transformed: computed key");
+    let log = [];
+    class A extends B {
+      constructor() {
+        let key;
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(10).method());
+          }
+          [((key = super(9).method()), log.push(key), key)];
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("9,10");
+    expect(a.foo).toBe(142);
+  }
+
+  {
+    ("super() within decorated derived constructor should be transformed: decorator expression");
+    let log = [];
+    const noop = () => (fn) => fn;
+    class A extends B {
+      constructor() {
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(12).method());
+          }
+          @noop(log.push(super(11).method())) noop() {}
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("11,12");
+    expect(a.foo).toBe(142);
+  }
+}
diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initField-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initField-existing-derived-constructor/output.js
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc--to-es2015/initField-existing-derived-constructor/output.js
@@ -0,0 +1,204 @@
+{
+  var _A2;
+  let _init_foo, _init_extra_foo;
+  let self, a, initCalled;
+  function deco(_, context) {
+    context.addInitializer(() => {
+      initCalled = true;
+    });
+  }
+  class B {
+    constructor(s) {
+      a = s;
+    }
+  }
+  var _A = /*#__PURE__*/new WeakMap();
+  class A extends B {
+    constructor() {
+      let a = 2;
+      self = ((super(a), babelHelpers.classPrivateFieldInitSpec(this, _A, _init_foo(this, 42)), this), _init_extra_foo(this));
+    }
+    get foo() {
+      return babelHelpers.classPrivateFieldGet2(_A, this);
+    }
+    set foo(v) {
+      babelHelpers.classPrivateFieldSet2(_A, this, v);
+    }
+  }
+  _A2 = A;
+  [_init_foo, _init_extra_foo] = babelHelpers.applyDecs2311(_A2, [], [[deco, 1, "foo"]], 0, void 0, B).e;
+  let instance = new A();
+  expect(self).toBe(instance);
+  expect(a).toBe(2);
+  expect(initCalled).toBe(true);
+}
+{
+  const dec = ({
+    get,
+    set
+  }) => {
+    return {
+      get() {
+        return get.call(this) + 100;
+      },
+      set(v) {
+        set.call(this, v);
+      }
+    };
+  };
+  class B {
+    constructor(v) {
+      this.a = v;
+    }
+    method() {
+      return this.a;
+    }
+  }
+  {
+    var _A4;
+    let _init_foo2, _init_extra_foo2;
+    "super() nested within another constructor should not be transformed";
+    let log = [];
+    var _A3 = /*#__PURE__*/new WeakMap();
+    class A extends B {
+      constructor() {
+        log.push(((super(3), babelHelpers.classPrivateFieldInitSpec(this, _A3, _init_foo2(this, 42)), this), _init_extra_foo2(this)).method());
+        new class Dummy extends B {
+          constructor() {
+            log.push(super(4).method());
+          }
+        }();
+      }
+      get foo() {
+        return babelHelpers.classPrivateFieldGet2(_A3, this);
+      }
+      set foo(v) {
+        babelHelpers.classPrivateFieldSet2(_A3, this, v);
+      }
+    }
+    _A4 = A;
+    [_init_foo2, _init_extra_foo2] = babelHelpers.applyDecs2311(_A4, [], [[dec, 1, "foo"]], 0, void 0, B).e;
+    const a = new A();
+    expect(log + "").toBe("3,4");
+    expect(a.foo).toBe(142);
+  }
+  {
+    "super() not in decorated derived constructor should not be transformed: computed key";
+    let log = [];
+    new class Dummy extends B {
+      constructor() {
+        var _A6;
+        let _init_foo3, _init_extra_foo3, _computedKey;
+        let key;
+        var _A5 = /*#__PURE__*/new WeakMap();
+        _computedKey = (key = super(5).method(), log.push(key), key);
+        class A extends B {
+          constructor() {
+            log.push((super(6), babelHelpers.classPrivateFieldInitSpec(this, _A5, _init_foo3(this, 42)), babelHelpers.defineProperty(this, _computedKey, void _init_extra_foo3(this))).method());
+          }
+          get foo() {
+            return babelHelpers.classPrivateFieldGet2(_A5, this);
+          }
+          set foo(v) {
+            babelHelpers.classPrivateFieldSet2(_A5, this, v);
+          }
+        }
+        _A6 = A;
+        [_init_foo3, _init_extra_foo3] = babelHelpers.applyDecs2311(_A6, [], [[dec, 1, "foo"]], 0, void 0, B).e;
+        const a = new A();
+        expect(a.foo).toBe(142);
+      }
+    }();
+    expect(log + "").toBe("5,6");
+  }
+  {
+    "super() in decorator expression within decorated derived constructor should be transformed: decorator expression";
+    let log = [];
+    const noop = () => fn => fn;
+    new class extends B {
+      constructor() {
+        var _A8;
+        let _initProto, _init_foo4, _init_extra_foo4, _noopDecs, _ref;
+        var _A7 = /*#__PURE__*/new WeakMap();
+        _ref = (_noopDecs = noop(log.push(super(7).method())), "foo");
+        class A extends B {
+          constructor() {
+            log.push(((super(8), babelHelpers.classPrivateFieldInitSpec(this, _A7, (_initProto(this), _init_foo4(this, 42))), this), _init_extra_foo4(this)).method());
+          }
+          get [_ref]() {
+            return babelHelpers.classPrivateFieldGet2(_A7, this);
+          }
+          set foo(v) {
+            babelHelpers.classPrivateFieldSet2(_A7, this, v);
+          }
+          noop() {}
+        }
+        _A8 = A;
+        [_init_foo4, _init_extra_foo4, _initProto] = babelHelpers.applyDecs2311(_A8, [], [[dec, 1, "foo"], [_noopDecs, 2, "noop"]], 0, void 0, B).e;
+        const a = new A();
+        expect(a.foo).toBe(142);
+      }
+    }();
+    expect(log + "").toBe("7,8");
+  }
+  {
+    var _A10;
+    let _init_foo5, _init_extra_foo5;
+    "super() within decorated derived constructor should be transformed: computed key";
+    let log = [];
+    var _A9 = /*#__PURE__*/new WeakMap();
+    class A extends B {
+      constructor() {
+        let _ref2;
+        let key;
+        new (_ref2 = (key = ((super(9), babelHelpers.classPrivateFieldInitSpec(this, _A9, _init_foo5(this, 42)), this), _init_extra_foo5(this)).method(), log.push(key), key), class Dummy extends B {
+          constructor() {
+            log.push((super(10), babelHelpers.defineProperty(this, _ref2, void 0)).method());
+          }
+        })();
+      }
+      get foo() {
+        return babelHelpers.classPrivateFieldGet2(_A9, this);
+      }
+      set foo(v) {
+        babelHelpers.classPrivateFieldSet2(_A9, this, v);
+      }
+    }
+    _A10 = A;
+    [_init_foo5, _init_extra_foo5] = babelHelpers.applyDecs2311(_A10, [], [[dec, 1, "foo"]], 0, void 0, B).e;
+    const a = new A();
+    expect(log + "").toBe("9,10");
+    expect(a.foo).toBe(142);
+  }
+  {
+    var _A12;
+    let _init_foo6, _init_extra_foo6;
+    "super() within decorated derived constructor should be transformed: decorator expression";
+    let log = [];
+    const noop = () => fn => fn;
+    var _A11 = /*#__PURE__*/new WeakMap();
+    class A extends B {
+      constructor() {
+        var _Dummy2;
+        let _initProto2, _noopDecs2, _ref3;
+        new (_ref3 = (_noopDecs2 = noop(log.push(((super(11), babelHelpers.classPrivateFieldInitSpec(this, _A11, _init_foo6(this, 42)), this), _init_extra_foo6(this)).method())), "noop"), (_Dummy2 = class Dummy extends B {
+          constructor() {
+            log.push(_initProto2(super(12)).method());
+          }
+          [_ref3]() {}
+        }, [_initProto2] = babelHelpers.applyDecs2311(_Dummy2, [], [[_noopDecs2, 2, "noop"]], 0, void 0, B).e, _Dummy2))();
+      }
+      get foo() {
+        return babelHelpers.classPrivateFieldGet2(_A11, this);
+      }
+      set foo(v) {
+        babelHelpers.classPrivateFieldSet2(_A11, this, v);
+      }
+    }
+    _A12 = A;
+    [_init_foo6, _init_extra_foo6] = babelHelpers.applyDecs2311(_A12, [], [[dec, 1, "foo"]], 0, void 0, B).e;
+    const a = new A();
+    expect(log + "").toBe("11,12");
+    expect(a.foo).toBe(142);
+  }
+}
diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initField-existing-derived-constructor/exec.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initField-existing-derived-constructor/exec.js
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initField-existing-derived-constructor/exec.js
@@ -0,0 +1,175 @@
+{
+  let self, a, initCalled;
+
+  function deco(_, context) {
+    context.addInitializer(() => {
+      initCalled = true;
+    });
+  }
+
+  class B {
+    constructor(s) {
+      a = s;
+    }
+  }
+
+  class A extends B {
+    constructor() {
+      let a = 2;
+      self = super(a);
+    }
+
+    @deco
+    accessor foo = 42;
+  }
+
+  let instance = new A();
+  expect(self).toBe(instance);
+  expect(a).toBe(2);
+  expect(initCalled).toBe(true);
+}
+
+{
+  const dec = ({ get, set }) => {
+    return {
+      get() {
+        return get.call(this) + 100;
+      },
+
+      set(v) {
+        set.call(this, v);
+      },
+    }
+  };
+
+  class B {
+    constructor(v) {
+      this.a = v;
+    }
+    method() {
+      return this.a;
+    }
+  }
+
+  {
+    ("super() nested within another constructor should not be transformed");
+    let log = [];
+    class A extends B {
+      constructor() {
+        log.push(super(3).method());
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(4).method());
+          }
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("3,4");
+    expect(a.foo).toBe(142);
+  }
+
+  {
+    ("super() not in decorated derived constructor should not be transformed: computed key");
+    let log = [];
+    new (class Dummy extends B {
+      constructor() {
+        let key;
+        class A extends B {
+          constructor() {
+            log.push(super(6).method());
+          }
+
+          @dec
+          accessor foo = 42;
+
+          [((key = super(5).method()), log.push(key), key)];
+        }
+
+        const a = new A();
+
+        expect(a.foo).toBe(142);
+      }
+    })();
+
+    expect(log + "").toBe("5,6");
+  }
+
+  {
+    ("super() in decorator expression within decorated derived constructor should be transformed: decorator expression");
+    let log = [];
+    const noop = () => (fn) => fn;
+    new (class extends B {
+      constructor() {
+        class A extends B {
+          constructor() {
+            log.push(super(8).method());
+          }
+
+          @dec
+          accessor foo = 42;
+
+          @noop(log.push(super(7).method())) noop() {}
+        }
+
+        const a = new A();
+        expect(a.foo).toBe(142);
+      }
+    })();
+
+    expect(log + "").toBe("7,8");
+  }
+
+  {
+    ("super() within decorated derived constructor should be transformed: computed key");
+    let log = [];
+    class A extends B {
+      constructor() {
+        let key;
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(10).method());
+          }
+          [((key = super(9).method()), log.push(key), key)];
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("9,10");
+    expect(a.foo).toBe(142);
+  }
+
+  {
+    ("super() within decorated derived constructor should be transformed: decorator expression");
+    let log = [];
+    const noop = () => (fn) => fn;
+    class A extends B {
+      constructor() {
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(12).method());
+          }
+          @noop(log.push(super(11).method())) noop() {}
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("11,12");
+    expect(a.foo).toBe(142);
+  }
+}
diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initField-existing-derived-constructor/input.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initField-existing-derived-constructor/input.js
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initField-existing-derived-constructor/input.js
@@ -0,0 +1,175 @@
+{
+  let self, a, initCalled;
+
+  function deco(_, context) {
+    context.addInitializer(() => {
+      initCalled = true;
+    });
+  }
+
+  class B {
+    constructor(s) {
+      a = s;
+    }
+  }
+
+  class A extends B {
+    constructor() {
+      let a = 2;
+      self = super(a);
+    }
+
+    @deco
+    accessor foo = 42;
+  }
+
+  let instance = new A();
+  expect(self).toBe(instance);
+  expect(a).toBe(2);
+  expect(initCalled).toBe(true);
+}
+
+{
+  const dec = ({ get, set }) => {
+    return {
+      get() {
+        return get.call(this) + 100;
+      },
+
+      set(v) {
+        set.call(this, v);
+      },
+    }
+  };
+
+  class B {
+    constructor(v) {
+      this.a = v;
+    }
+    method() {
+      return this.a;
+    }
+  }
+
+  {
+    ("super() nested within another constructor should not be transformed");
+    let log = [];
+    class A extends B {
+      constructor() {
+        log.push(super(3).method());
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(4).method());
+          }
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("3,4");
+    expect(a.foo).toBe(142);
+  }
+
+  {
+    ("super() not in decorated derived constructor should not be transformed: computed key");
+    let log = [];
+    new (class Dummy extends B {
+      constructor() {
+        let key;
+        class A extends B {
+          constructor() {
+            log.push(super(6).method());
+          }
+
+          @dec
+          accessor foo = 42;
+
+          [((key = super(5).method()), log.push(key), key)];
+        }
+
+        const a = new A();
+
+        expect(a.foo).toBe(142);
+      }
+    })();
+
+    expect(log + "").toBe("5,6");
+  }
+
+  {
+    ("super() in decorator expression within decorated derived constructor should be transformed: decorator expression");
+    let log = [];
+    const noop = () => (fn) => fn;
+    new (class extends B {
+      constructor() {
+        class A extends B {
+          constructor() {
+            log.push(super(8).method());
+          }
+
+          @dec
+          accessor foo = 42;
+
+          @noop(log.push(super(7).method())) noop() {}
+        }
+
+        const a = new A();
+        expect(a.foo).toBe(142);
+      }
+    })();
+
+    expect(log + "").toBe("7,8");
+  }
+
+  {
+    ("super() within decorated derived constructor should be transformed: computed key");
+    let log = [];
+    class A extends B {
+      constructor() {
+        let key;
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(10).method());
+          }
+          [((key = super(9).method()), log.push(key), key)];
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("9,10");
+    expect(a.foo).toBe(142);
+  }
+
+  {
+    ("super() within decorated derived constructor should be transformed: decorator expression");
+    let log = [];
+    const noop = () => (fn) => fn;
+    class A extends B {
+      constructor() {
+        new (class Dummy extends B {
+          constructor() {
+            log.push(super(12).method());
+          }
+          @noop(log.push(super(11).method())) noop() {}
+        })();
+      }
+
+      @dec
+      accessor foo = 42;
+    }
+
+    const a = new A();
+
+    expect(log + "").toBe("11,12");
+    expect(a.foo).toBe(142);
+  }
+}
diff --git a/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initField-existing-derived-constructor/output.js b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initField-existing-derived-constructor/output.js
new file mode 100644
--- /dev/null
+++ b/packages/babel-plugin-proposal-decorators/test/fixtures/2023-11-misc/initField-existing-derived-constructor/output.js
@@ -0,0 +1,205 @@
+{
+  let _init_foo, _init_extra_foo;
+  let self, a, initCalled;
+  function deco(_, context) {
+    context.addInitializer(() => {
+      initCalled = true;
+    });
+  }
+  class B {
+    constructor(s) {
+      a = s;
+    }
+  }
+  class A extends B {
+    static {
+      [_init_foo, _init_extra_foo] = babelHelpers.applyDecs2311(this, [], [[deco, 1, "foo"]], 0, void 0, B).e;
+    }
+    constructor() {
+      let a = 2;
+      self = (super(a), _init_extra_foo(this));
+    }
+    #A = _init_foo(this, 42);
+    get foo() {
+      return this.#A;
+    }
+    set foo(v) {
+      this.#A = v;
+    }
+  }
+  let instance = new A();
+  expect(self).toBe(instance);
+  expect(a).toBe(2);
+  expect(initCalled).toBe(true);
+}
+{
+  const dec = ({
+    get,
+    set
+  }) => {
+    return {
+      get() {
+        return get.call(this) + 100;
+      },
+      set(v) {
+        set.call(this, v);
+      }
+    };
+  };
+  class B {
+    constructor(v) {
+      this.a = v;
+    }
+    method() {
+      return this.a;
+    }
+  }
+  {
+    let _init_foo2, _init_extra_foo2;
+    "super() nested within another constructor should not be transformed";
+    let log = [];
+    class A extends B {
+      static {
+        [_init_foo2, _init_extra_foo2] = babelHelpers.applyDecs2311(this, [], [[dec, 1, "foo"]], 0, void 0, B).e;
+      }
+      constructor() {
+        log.push((super(3), _init_extra_foo2(this)).method());
+        new class Dummy extends B {
+          constructor() {
+            log.push(super(4).method());
+          }
+        }();
+      }
+      #A = _init_foo2(this, 42);
+      get foo() {
+        return this.#A;
+      }
+      set foo(v) {
+        this.#A = v;
+      }
+    }
+    const a = new A();
+    expect(log + "").toBe("3,4");
+    expect(a.foo).toBe(142);
+  }
+  {
+    "super() not in decorated derived constructor should not be transformed: computed key";
+    let log = [];
+    new class Dummy extends B {
+      constructor() {
+        let _init_foo3, _init_extra_foo3, _computedKey;
+        let key;
+        class A extends B {
+          static {
+            [_init_foo3, _init_extra_foo3] = babelHelpers.applyDecs2311(this, [], [[dec, 1, "foo"]], 0, void 0, B).e;
+          }
+          constructor() {
+            log.push(super(6).method());
+          }
+          #A = _init_foo3(this, 42);
+          get foo() {
+            return this.#A;
+          }
+          set foo(v) {
+            this.#A = v;
+          }
+          [_computedKey = (key = super(5).method(), log.push(key), key)] = void _init_extra_foo3(this);
+        }
+        const a = new A();
+        expect(a.foo).toBe(142);
+      }
+    }();
+    expect(log + "").toBe("5,6");
+  }
+  {
+    "super() in decorator expression within decorated derived constructor should be transformed: decorator expression";
+    let log = [];
+    const noop = () => fn => fn;
+    new class extends B {
+      constructor() {
+        let _initProto, _init_foo4, _init_extra_foo4, _noopDecs;
+        class A extends B {
+          static {
+            [_init_foo4, _init_extra_foo4, _initProto] = babelHelpers.applyDecs2311(this, [], [[dec, 1, "foo"], [_noopDecs, 2, "noop"]], 0, void 0, B).e;
+          }
+          constructor() {
+            log.push((super(8), _init_extra_foo4(this)).method());
+          }
+          #A = (_initProto(this), _init_foo4(this, 42));
+          get [(_noopDecs = noop(log.push(super(7).method())), "foo")]() {
+            return this.#A;
+          }
+          set foo(v) {
+            this.#A = v;
+          }
+          noop() {}
+        }
+        const a = new A();
+        expect(a.foo).toBe(142);
+      }
+    }();
+    expect(log + "").toBe("7,8");
+  }
+  {
+    let _init_foo5, _init_extra_foo5;
+    "super() within decorated derived constructor should be transformed: computed key";
+    let log = [];
+    class A extends B {
+      static {
+        [_init_foo5, _init_extra_foo5] = babelHelpers.applyDecs2311(this, [], [[dec, 1, "foo"]], 0, void 0, B).e;
+      }
+      constructor() {
+        let key;
+        new class Dummy extends B {
+          constructor() {
+            log.push(super(10).method());
+          }
+          [(key = (super(9), _init_extra_foo5(this)).method(), log.push(key), key)];
+        }();
+      }
+      #A = _init_foo5(this, 42);
+      get foo() {
+        return this.#A;
+      }
+      set foo(v) {
+        this.#A = v;
+      }
+    }
+    const a = new A();
+    expect(log + "").toBe("9,10");
+    expect(a.foo).toBe(142);
+  }
+  {
+    let _init_foo6, _init_extra_foo6;
+    "super() within decorated derived constructor should be transformed: decorator expression";
+    let log = [];
+    const noop = () => fn => fn;
+    class A extends B {
+      static {
+        [_init_foo6, _init_extra_foo6] = babelHelpers.applyDecs2311(this, [], [[dec, 1, "foo"]], 0, void 0, B).e;
+      }
+      constructor() {
+        let _initProto2, _noopDecs2;
+        new class Dummy extends B {
+          static {
+            [_initProto2] = babelHelpers.applyDecs2311(this, [], [[_noopDecs2, 2, "noop"]], 0, void 0, B).e;
+          }
+          constructor() {
+            log.push(_initProto2(super(12)).method());
+          }
+          [(_noopDecs2 = noop(log.push((super(11), _init_extra_foo6(this)).method())), "noop")]() {}
+        }();
+      }
+      #A = _init_foo6(this, 42);
+      get foo() {
+        return this.#A;
+      }
+      set foo(v) {
+        this.#A = v;
+      }
+    }
+    const a = new A();
+    expect(log + "").toBe("11,12");
+    expect(a.foo).toBe(142);
+  }
+}