Skip to content

[Bug]: Element decorator referencing both this and local private field is not compiled properly #16295

@nicolo-ribaudo

Description

@nicolo-ribaudo

💻

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

class A {
  #x = console.log.bind(console, "outer #x");
  foo() {
    let after;
    
    @(new A().#x)
    class B {
	  #x = console.log.bind(console, "inner #x");
      @(after = () => new B().#x(this instanceof A), () => {}) f;
    }

    after();
  }
}

new A().foo();

Configuration file name

No response

Configuration

Decorators 2023-05 and (unreleased) 2023-11

Current and expected behavior

I think it should log

"outer #x", class B {}, { kind: "class", ... }
"inner #x", true

but it throws about the second #x access

Environment

main

Possible solution

No response

Additional context

No response

Metadata

Metadata

Labels

Spec: DecoratorsoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions