global

def comments

def comments
  case entry = env.constant_entry(full_name)
  when ::RBS::Environment::ConstantEntry
    [entry.decl.comment]
  when ::RBS::Environment::ClassEntry, ::RBS::Environment::ModuleEntry
    entry.each_decl.map do |decl|
      case decl
      when ::RBS::AST::Declarations::Base
        decl.comment
      when ::RBS::AST::Ruby::Declarations::Base
        nil
      end
    end
  when ::RBS::Environment::ClassAliasEntry, ::RBS::Environment::ModuleAliasEntry
    [entry.decl.comment]
  else
    raise
  end
end