Skip to content

Commit

Permalink
Add NextNode
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre committed Jul 18, 2020
1 parent 67a56e5 commit 4dee1c2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* [#55](https://github.com/rubocop-hq/rubocop-ast/pull/55): Add `ProcessedSource#line_with_comment?`. ([@marcandre][])
* [#63](https://github.com/rubocop-hq/rubocop-ast/pull/63): NodePattern now supports patterns as arguments to predicate and functions. ([@marcandre][])
* [#64](https://github.com/rubocop-hq/rubocop-ast/pull/64): Add `Node#global_const?`. ([@marcandre][])
* [#70](https://github.com/rubocop-hq/rubocop-ast/pull/70): Add `NextNode` ([@marcandre][])

### Bug fixes

Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/ast.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
require_relative 'ast/node/keyword_splat_node'
require_relative 'ast/node/lambda_node'
require_relative 'ast/node/module_node'
require_relative 'ast/node/next_node'
require_relative 'ast/node/or_node'
require_relative 'ast/node/pair_node'
require_relative 'ast/node/range_node'
Expand Down
1 change: 1 addition & 0 deletions lib/rubocop/ast/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Builder < Parser::Builders::Default
kwsplat: KeywordSplatNode,
lambda: LambdaNode,
module: ModuleNode,
next: NextNode,
or: OrNode,
pair: PairNode,
regexp: RegexpNode,
Expand Down
13 changes: 13 additions & 0 deletions lib/rubocop/ast/node/next_node.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

module RuboCop
module AST
# A node extension for `next` nodes. This will be used in place of a
# plain node when the builder constructs the AST, making its methods
# available to all `next` nodes within RuboCop.
class NextNode < Node
include ParameterizedNode
include WrappedArgumentsNode
end
end
end
7 changes: 7 additions & 0 deletions spec/rubocop/ast/next_node_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

require_relative 'wrapped_arguments_node'

RSpec.describe RuboCop::AST::NextNode do
it_behaves_like 'wrapped arguments node', 'next'
end

0 comments on commit 4dee1c2

Please sign in to comment.