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

Unify, simplify and fixup assignment errors #4221

Merged
merged 1 commit into from
Mar 6, 2016

Conversation

lydell
Copy link
Collaborator

@lydell lydell commented Mar 5, 2016

  • Show the same type of error message for compound assignment as for =
    assignment when the LHS is invalid.
  • Show the same type of error message when trying to assign to a CoffeeScript
    keyword as when trying to assign to a JavaScript keyword.
  • Now longer treat && = as &&=. The same goes for and=, ||= and or=.
  • Unify the error message to: <optional type> '<value>' can't be assigned.

skipToken = true
if prev and prev.variable
origin = prev.origin ? prev
if message = isUnassignable prev[1], origin[1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this pattern of doing an assignment in a condition really unreadable and error-prone.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed all occurrences in the diff.

- Show the same type of error message for compound assignment as for `=`
  assignment when the LHS is invalid.
- Show the same type of error message when trying to assign to a CoffeeScript
  keyword as when trying to assign to a JavaScript keyword.
- Now longer treat `&& =` as `&&=`. The same goes for `and=`, `||=` and `or=`.
- Unify the error message to: `<optional type> '<value>' can't be assigned`.
michaelficarra added a commit that referenced this pull request Mar 6, 2016
Unify, simplify and fixup assignment errors
@michaelficarra michaelficarra merged commit 5b7ac32 into jashkenas:master Mar 6, 2016
@lydell lydell deleted the assignment-errors branch March 6, 2016 09:43
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

Successfully merging this pull request may close these issues.

2 participants