-
Notifications
You must be signed in to change notification settings - Fork 64
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
scope bug: read-only error #59
Comments
My first guess is that we can only improve this by delaying validation of update and assignment expressions till after we traversed the whole tree. A simpler alternative would be to turn this error into a warning. |
I think the former is the way to go. A warning with false positives is not helpful. Acorn catches a number of these types of errors doesn't it? If so, maybe this logic is not required at all. |
Well, I think a warning would be a reasonable approach, exactly because it could be a false positive. Also, a) it is easily fixable b) it is confusing for humans, so fixing it makes sense anyway. But I'm not opposed to the more elaborate and correct solution. As far as I know acorn doesn't do anything like this, for example it parses |
The problem is that warnings are almost always ignored by users - even if valid. What's the downside of passing illegal code to Buble as you have above? The generated code will incorrectly behave as if the |
Yes, it will be transpiled to a |
That doesn't sound desirable - particularly for users like me who never use linters. |
I actually found an easy solution for this: The checks used to happen in |
@adrianheine Well done! Thanks. |
Related sources:
src/program/types/AssignmentExpression.js#L7-L9
src/program/types/UpdateExpression.js#L7-L11
The text was updated successfully, but these errors were encountered: