private static long HashModuleFileSizes(IImportChildrenSource source)
        {
            var hash  = 0L;
            var names = source.GetChildrenNames();

            foreach (var name in names)
            {
                if (source.TryGetChildImport(name, out var child))
                {
                    if (child is ModuleImport moduleImport)
                    {
                        if (moduleImport.ModuleFileSize == 0)
                        {
                            continue; // Typically test case, memory-only module.
                        }
                        hash = unchecked (hash * 31 ^ moduleImport.ModuleFileSize);
                    }

                    if (child is IImportChildrenSource childSource)
                    {
                        hash = unchecked (hash * 31 ^ HashModuleFileSizes(childSource));
                    }
                }
            }

            return(hash);
        }
Esempio n. 2
0
        private static long HashModuleFileSizes(IImportChildrenSource source)
        {
            var hash  = 0L;
            var names = source.GetChildrenNames();

            foreach (var name in names)
            {
                if (source.TryGetChildImport(name, out var child))
                {
                    if (child is ModuleImport moduleImport)
                    {
                        hash = unchecked (hash * 31 ^ moduleImport.ModuleFileSize);
                    }

                    if (child is IImportChildrenSource childSource)
                    {
                        hash = unchecked (hash * 31 ^ HashModuleFileSizes(childSource));
                    }
                }
            }

            return(hash);
        }
 public ImmutableArray <string> GetChildrenNames() => _childrenSource.GetChildrenNames();