Method: SyntaxTree::In#copy

Defined in:
lib/syntax_tree/node.rb

#copy(pattern: nil, statements: nil, consequent: nil, location: nil) ⇒ Object



6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
# File 'lib/syntax_tree/node.rb', line 6778

def copy(pattern: nil, statements: nil, consequent: nil, location: nil)
  node =
    In.new(
      pattern: pattern || self.pattern,
      statements: statements || self.statements,
      consequent: consequent || self.consequent,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end