Method: RubyCrystalCodemod::Formatter#visit_path

Defined in:
lib/ruby_crystal_codemod/formatter.rb

#visit_path(node) ⇒ Object



832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
# File 'lib/ruby_crystal_codemod/formatter.rb', line 832

def visit_path(node)
  # Foo::Bar
  #
  # [:const_path_ref,
  #   [:var_ref, [:@const, "Foo", [1, 0]]],
  #   [:@const, "Bar", [1, 5]]]
  pieces = node[1..-1]
  pieces.each_with_index do |piece, i|
    visit piece
    unless last?(i, pieces)
      consume_op "::"
      skip_space_or_newline
    end
  end
end