public InterproceduralDaemonStageProcess(
            [NotNull] IDaemonProcess process,
            [NotNull] ICSharpFile file) :
            base(process, file)
        {
            mySolution = process.Solution;

            var completedStageProcesses = process.GetCompletedStageProcesses();
            var filtered = completedStageProcesses.Where(completedProcess => completedProcess is IHierarchyAnalysisStageProcess).ToList();
            var hierarchyAnalysisStageProcess = filtered.IsEmpty() ? null : filtered.First() as IHierarchyAnalysisStageProcess;

            if (hierarchyAnalysisStageProcess == null)
            {
                return;
            }

            foreach (var memberInheritanceInfo in hierarchyAnalysisStageProcess.MemberInheritances)
            {
                if (memberInheritanceInfo.Member is IMethod method)
                {
                    myHierarchyMembers.AddValue(method, memberInheritanceInfo.BaseMember as IMethod);
                }
//                else if (memberInheritanceInfo.Member is IConstructor constructor)
//                {
//                    System.IO.File.WriteAllText(@"C:\methodsExceptions\constructors.txt", constructor.ShortName + '\n');
//                    myConstructorBases.AddValue(constructor, memberInheritanceInfo.BaseMember as IConstructor);
//                }
            }
        }
        protected override void Analyze(IPropertiesValue element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer)
        {
            var propertiesByName = new OneToListMap <string, IPropertyDeclaration>();

            foreach (var propertyDeclaration in element.DeclarationsEnumerable)
            {
                var propertyName = propertyDeclaration.Name?.GetText();
                if (string.IsNullOrEmpty(propertyName))
                {
                    continue;
                }

                propertiesByName.AddValue(propertyName, propertyDeclaration);
            }

            foreach (var pair in propertiesByName)
            {
                if (pair.Value.Count > 1)
                {
                    var propertyDeclaration = pair.Value[0];
                    consumer.AddHighlighting(new ShaderLabFirstDuplicatePropertyWarning(propertyDeclaration, pair.Key,
                                                                                        propertyDeclaration.Name.GetHighlightingRange()));
                    for (var i = 1; i < pair.Value.Count; i++)
                    {
                        propertyDeclaration = pair.Value[i];
                        consumer.AddHighlighting(new ShaderLabSubsequentDuplicatePropertyWarning(propertyDeclaration,
                                                                                                 pair.Key, propertyDeclaration.Name.GetHighlightingRange()));
                    }
                }
            }
        }
Exemple #3
0
        private static List <IMetadataMethod> GetAllTestMethods(IMetadataTypeInfo typeInfo)
        {
            var list = new List <IMetadataMethod>();
            var map  = new OneToListMap <string, IMetadataMethod>();

            while (typeInfo != null)
            {
                foreach (IMetadataMethod method in typeInfo.GetMethods())
                {
                    if (!IsTestMethod(method))
                    {
                        continue;
                    }

                    if (map.ContainsKey(method.Name) && (method.IsVirtual))
                    {
                        bool hasOverride = false;
                        foreach (IMetadataMethod metadataMethod in map[method.Name])
                        {
                            if (metadataMethod.IsVirtual && !metadataMethod.IsNewSlot)
                            {
                                hasOverride = true;
                            }
                        }

                        if (hasOverride)
                        {
                            continue;
                        }
                    }

                    map.AddValue(method.Name, method);
                    list.Add(method);
                }

                IMetadataClassType baseType = typeInfo.Base;
                typeInfo = (baseType != null) ? baseType.Type : null;
            }

            return(list);
        }