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

Support right hand assignment #89

Merged
merged 1 commit into from Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,7 @@
* [#83](https://github.com/rubocop-hq/rubocop-ast/pull/83): Add `ProcessedSource#each_comment_in_lines` ([@marcandre][])
* [#84](https://github.com/rubocop-hq/rubocop-ast/pull/84): Add `Source::Range#line_span` ([@marcandre][])
* [#87](https://github.com/rubocop-hq/rubocop-ast/pull/87): Add `CaseNode#branches` ([@marcandre][])
* [#89](https://github.com/rubocop-hq/rubocop-ast/pull/89): Support `mrasgn` has the same structure as `masgn` except that the child nodes are reversed for Ruby 2.8 (3.0) parser. ([@koic][])

### Bug fixes

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/ast/node.rb
Expand Up @@ -38,7 +38,7 @@ class Node < Parser::AST::Node # rubocop:disable Metrics/ClassLength
IMMUTABLE_LITERALS = (LITERALS - MUTABLE_LITERALS).freeze

EQUALS_ASSIGNMENTS = %i[lvasgn ivasgn cvasgn gvasgn
casgn masgn].freeze
casgn masgn rasgn mrasgn].freeze
SHORTHAND_ASSIGNMENTS = %i[op_asgn or_asgn and_asgn].freeze
ASSIGNMENTS = (EQUALS_ASSIGNMENTS + SHORTHAND_ASSIGNMENTS).freeze

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/ast/traversal.rb
Expand Up @@ -28,7 +28,7 @@ def walk(node)
arg_expr pin match_rest if_guard unless_guard
match_with_trailing_comma].freeze
MANY_CHILD_NODES = %i[dstr dsym xstr regexp array hash pair
mlhs masgn or_asgn and_asgn
mlhs masgn or_asgn and_asgn rasgn mrasgn
undef alias args super yield or and
while_post until_post iflipflop eflipflop
match_with_lvasgn begin kwbegin return
Expand Down