jashkenas / jashkenas/coffeescript
[BUG] exp in class definition
Open
Nobody has claimed this yet.
- Dominant language
- CoffeeScript
- Stars
- 16.6k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
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]() {}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by compiling the CoffeeScript class example from the issue and compare the generated JavaScript with the expected output. Trace the compiler's handling of computed class properties and class-body expressions; done means removing the invalid this.[...] syntax and using the class reference rather than the constructor's this.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- coffeescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100