<commit_before>﻿// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.FindSymbols
{
    internal partial class SyntaxTreeIndex
    {
        private readonly struct DeclarationInfo
        {
            public ImmutableArray<DeclaredSymbolInfo> DeclaredSymbolInfos { get; }

            public DeclarationInfo(ImmutableArray<DeclaredSymbolInfo> declaredSymbolInfos)
                => DeclaredSymbolInfos = declaredSymbolInfos;

            public void WriteTo(ObjectWriter writer)
            {
                writer.WriteInt32(DeclaredSymbolInfos.Length);
                foreach (var declaredSymbolInfo in DeclaredSymbolInfos)
                    declaredSymbolInfo.WriteTo(writer);
            }

            public static DeclarationInfo? TryReadFrom(StringTable stringTable, ObjectReader reader)
            {
                try
                {
                    var declaredSymbolCount = reader.ReadInt32();
                    using var _ = ArrayBuilder<DeclaredSymbolInfo>.GetInstance(out var result);
                    for (var i = 0; i < declaredSymbolCount; i++)
                        result.Add(DeclaredSymbolInfo.ReadFrom_ThrowsOnFailure(stringTable, reader));

                    return new DeclarationInfo(result.ToImmutable());
                }
                catch (Exception)
                {
                }

                return null;
            }
        }
    }
}<commit_msg>Use count<commit_after>﻿// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Collections.Immutable;
using Microsoft.CodeAnalysis.PooledObjects;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.FindSymbols
{
    internal partial class SyntaxTreeIndex
    {
        private readonly struct DeclarationInfo
        {
            public ImmutableArray<DeclaredSymbolInfo> DeclaredSymbolInfos { get; }

            public DeclarationInfo(ImmutableArray<DeclaredSymbolInfo> declaredSymbolInfos)
                => DeclaredSymbolInfos = declaredSymbolInfos;

            public void WriteTo(ObjectWriter writer)
            {
                writer.WriteInt32(DeclaredSymbolInfos.Length);
                foreach (var declaredSymbolInfo in DeclaredSymbolInfos)
                    declaredSymbolInfo.WriteTo(writer);
            }

            public static DeclarationInfo? TryReadFrom(StringTable stringTable, ObjectReader reader)
            {
                try
                {
                    var declaredSymbolCount = reader.ReadInt32();
                    using var _ = ArrayBuilder<DeclaredSymbolInfo>.GetInstance(declaredSymbolCount, out var result);
                    for (var i = 0; i < declaredSymbolCount; i++)
                        result.Add(DeclaredSymbolInfo.ReadFrom_ThrowsOnFailure(stringTable, reader));

                    return new DeclarationInfo(result.ToImmutable());
                }
                catch (Exception)
                {
                }

                return null;
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.06237595690388432, 'fraction_numerical': 0.002835270768358378, 'mean_word_length': 2.0231362467866325, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7063640', 'n_tokens_mistral': 843, 'n_tokens_neox': 791, 'n_words': 216}