swc icon indicating copy to clipboard operation
swc copied to clipboard

fix(es/es2015): Fix injection location of `this` for getter/setter properties

Open kdy1 opened this issue 1 year ago • 1 comments
trafficstars

Description:

Related issue:

  • Closes #8992

kdy1 avatar May 28 '24 22:05 kdy1

Pathological example but I think this change might break on arrow functions being inside of computed property names. Can you try:

const o1 = {
  x: "a",
  foo() {
    const o2 = {
      get [(() => this.x)()]() {
        return 1;
      },
    };
    console.log(o2.a === 1);
  },
};

o1.foo();

KyleDavidE avatar May 29 '24 18:05 KyleDavidE