diff --git a/CHANGELOG.md b/CHANGELOG.md index 50ebca5e8..2c6216522 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,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 diff --git a/lib/rubocop/ast/node.rb b/lib/rubocop/ast/node.rb index ffe3305e7..9a1497aac 100644 --- a/lib/rubocop/ast/node.rb +++ b/lib/rubocop/ast/node.rb @@ -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 diff --git a/lib/rubocop/ast/traversal.rb b/lib/rubocop/ast/traversal.rb index 63fe59e92..30a37ecbc 100644 --- a/lib/rubocop/ast/traversal.rb +++ b/lib/rubocop/ast/traversal.rb @@ -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