-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Flow error on using this.x as a default param in a class #1234
Comments
|
It's very possible I got the scoping wrong on the default expr. I suspect you are right here, but it would be very helpful if you could link to the relevant part of the spec that indicates what |
@samwgoldman |
A default expression is not evaluated until it is necessary, and will be re-evaluated on every call that needs it. It also does not capture the outer I am not entirely sure on the spec language, but I'm trying to follow the definition of [[Call]]. By the time the default expression evaluation at FunctionDeclarationInstantiation.28 happens (called from OrdinaryCallEvaluateBody), the OrdinaryCallBindThis has already happened. The defaults should see the same This, of course, still allows it to be either global (in sloppy mode) or undefined if you go and extract it and call it as a function, but that is not how you normally use a method declared in a class. Arrow functions bind their |
Is there any updates / workarounds on this one? |
This shouldn't be an error right?
flow 0.20.0, node 5.1.0
The text was updated successfully, but these errors were encountered: