Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] exp in class definition #5289

Open
MegaJSDeveloper opened this issue Jan 20, 2020 · 0 comments
Open

[BUG] exp in class definition #5289

MegaJSDeveloper opened this issue Jan 20, 2020 · 0 comments

Comments

@MegaJSDeveloper
Copy link

MegaJSDeveloper commented Jan 20, 2020

CoffeeScript:

class Cat
  
  [@symbol]: =>

Output Javascript:

class Cat {
  constructor() {
    this.[this.symbol] = this.[this.symbol].bind(this);
  }

  [this.symbol]() {}
}

But must compile like this:

class Cat {
  constructor() {
    this[Cat.symbol] = this[Cat.symbol].bind(this);
  }

  [Cat.symbol]() {}
}

Two bugs:

this in constructor is not this in class body
not need dot after this keyword, this.[exp] is syntax error this.[this.symbol]

Reason:

class {
  [EXP PROP NAME IN CLASS BODY NOT WORKING CORRECT]() {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant