Method: SyntaxTree::Field#copy

Defined in:
lib/syntax_tree/node.rb

#copy(parent: nil, operator: nil, name: nil, location: nil) ⇒ Object



5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
# File 'lib/syntax_tree/node.rb', line 5321

def copy(parent: nil, operator: nil, name: nil, location: nil)
  node =
    Field.new(
      parent: parent || self.parent,
      operator: operator || self.operator,
      name: name || self.name,
      location: location || self.location
    )

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