Skip to content

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.

src/lexer.coffee Outdated
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`.
@lydell lydell force-pushed the assignment-errors branch from 47f5573 to 4d8cd03 Compare March 6, 2016 09:34
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