Skip to content

Commit

Permalink
Args -> ArgumentsNode
Browse files Browse the repository at this point in the history
- Fixes ruby-syntax-tree#351
- Changed all use of `parts` to `arguments` as well.
  • Loading branch information
davidwessman committed May 2, 2023
1 parent d08d23b commit 450c702
Show file tree
Hide file tree
Showing 13 changed files with 209 additions and 177 deletions.
6 changes: 3 additions & 3 deletions lib/syntax_tree/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def ArgParen(arguments)
ArgParen.new(arguments: arguments, location: Location.default)
end

# Create a new Args node.
def Args(parts)
Args.new(parts: parts, location: Location.default)
# Create a new ArgumentsNode node.
def ArgumentsNode(arguments)
ArgumentsNode.new(arguments: arguments, location: Location.default)
end

# Create a new ArgBlock node.
Expand Down
6 changes: 3 additions & 3 deletions lib/syntax_tree/field_visitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def visit_arg_star(node)
end
end

def visit_args(node)
node(node, "args") do
list("parts", node.parts)
def visit_arguments_node(node)
node(node, "arguments_node") do
list("arguments", node.arguments)
comments(node)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/syntax_tree/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def visit_command(node)
node.location.start_column
)

node.arguments.parts.each do |argument|
node.arguments.arguments.each do |argument|
next unless argument.is_a?(SymbolLiteral)
name = argument.value.value.to_sym

Expand Down
6 changes: 3 additions & 3 deletions lib/syntax_tree/mutation_visitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def visit_arg_paren(node)
node.copy(arguments: visit(node.arguments))
end

# Visit a Args node.
def visit_args(node)
node.copy(parts: visit_all(node.parts))
# Visit a ArgumentsNode node.
def visit_arguments_node(node)
node.copy(arguments: visit_all(node.arguments))
end

# Visit a ArgBlock node.
Expand Down
Loading

0 comments on commit 450c702

Please sign in to comment.