コード例 #1
0
 public IEnumerable <object> GetUniqueValues(MonoBehaviourProperty query)
 {
     foreach (var v in myUniquePropertyValues.GetValues(query))
     {
         yield return(v);
     }
 }
コード例 #2
0
 public IEnumerable <MonoBehaviourPropertyValueWithLocation> GetPropertyValues(MonoBehaviourProperty query)
 {
     foreach (var v in myPropertyValues.GetValues(query))
     {
         yield return(v);
     }
 }
コード例 #3
0
        public LocalList <IPsiSourceFile> GetPossibleFilesWithUsage(IField element)
        {
            var result = new LocalList <IPsiSourceFile>();

            foreach (var name in AssetUtils.GetAllNamesFor(element))
            {
                foreach (var sourceFile in myNameToSourceFile.GetValues(name))
                {
                    result.Add(sourceFile);
                }
            }

            return(result);
        }
コード例 #4
0
        public bool IsPossibleEventHandler(IDeclaredElement declaredElement)
        {
            myShellLocks.AssertReadAccessAllowed();

            if (declaredElement is IProperty property)
            {
                var setter = property.Setter;
                if (setter != null && myShortNameToScriptTarget.GetValues(setter.ShortName).Length > 0)
                {
                    return(true);
                }

                var getter = property.Getter;
                if (getter != null && myShortNameToScriptTarget.GetValues(getter.ShortName).Length > 0)
                {
                    return(true);
                }

                return(false);
            }

            return(myShortNameToScriptTarget.GetValues(declaredElement.ShortName).Length > 0);
        }
コード例 #5
0
        public IEnumerable <IPsiSourceFile> GetPossibleFilesWithUsage([NotNull] IDeclaredElement element)
        {
            AssertShellLocks();
            if (!(element is IClrDeclaredElement clrDeclaredElement))
            {
                return(EmptyList <IPsiSourceFile> .Enumerable);
            }
            var elementGuid = FindGuidOf(clrDeclaredElement);

            if (!elementGuid.HasValue)
            {
                return(EmptyList <IPsiSourceFile> .Enumerable);
            }
            // TODO: Fix. Search for subtypes
            var name  = element.ShortName;
            var found = myNameToGuids.TryGetValue(name, out var guidsAndCounts);

            if (!found)
            {
                return(EmptyList <IPsiSourceFile> .Enumerable);
            }
            var elementType          = clrDeclaredElement.GetContainingType();
            var descendentTypesGuids = guidsAndCounts
                                       .Select(guidAndCount => guidAndCount.Key)
                                       .Where(g => AssetUtils.GetTypeElementFromScriptAssetGuid(mySolution, g)?.IsDescendantOf(elementType) ??
                                              false);
            var files = new List <IPsiSourceFile>();

            files.AddRange(myUsageToSourceFiles.GetValues(Pair.Of(name, elementGuid.Value)));
            foreach (var descendentTypesGuid in descendentTypesGuids)
            {
                files.AddRange(myUsageToSourceFiles.GetValues(Pair.Of(name, descendentTypesGuid)));
            }

            return(files);
        }
コード例 #6
0
        public LocalList <IPsiSourceFile> GetPossibleFilesWithScriptUsages(IClass scriptClass)
        {
            var guid = AssetUtils.GetGuidFor(myMetaFileGuidCache, scriptClass);

            if (guid == null)
            {
                return(new LocalList <IPsiSourceFile>());
            }

            var result = new LocalList <IPsiSourceFile>();

            foreach (var assetUsage in myUsageToSourceFiles.GetValues(guid.Value))
            {
                result.Add(assetUsage);
            }

            return(result);
        }
コード例 #7
0
        public LocalList <IPsiSourceFile> GetPossibleFilesWithUsage(ITypeElement declaredElement)
        {
            var guid = AssetUtils.GetGuidFor(myMetaFileGuidCache, declaredElement);

            if (guid == null)
            {
                return(new LocalList <IPsiSourceFile>());
            }

            var result = new LocalList <IPsiSourceFile>();

            foreach (var assetUsage in myUsageToSourceFiles.GetValues(guid.Value))
            {
                result.Add(assetUsage);
            }

            return(result);
        }
コード例 #8
0
        public static bool HasPossibleDerivedTypesWithMember(Guid ownerGuid, ITypeElement containingType, IEnumerable <string> memberNames, OneToCompactCountingSet <int, Guid> nameHashToGuids)
        {
            var count = 0;

            foreach (var possibleName in memberNames)
            {
                var values = nameHashToGuids.GetValues(possibleName.GetPlatformIndependentHashCode());
                count += values.Length;
                if (values.Length == 1 && !values[0].Equals(ownerGuid))
                {
                    count++;
                }
            }

            if (count > 1)
            {
                // TODO: drop daemon dependency and inject compoentns in consructor
                var configuration = containingType.GetSolution().GetComponent <SolutionAnalysisConfiguration>();
                if (configuration.Enabled.Value && configuration.CompletedOnceAfterStart.Value &&
                    configuration.Loaded.Value)
                {
                    var service = containingType.GetSolution().GetComponent <SolutionAnalysisService>();
                    var id      = service.GetElementId(containingType);
                    if (id.HasValue && service.UsageChecker is IGlobalUsageChecker checker)
                    {
                        // no inheritors
                        if (checker.GetDerivedTypeElementsCount(id.Value) == 0)
                        {
                            return(false);
                        }
                    }
                }

                return(true);
            }

            return(false);
        }
コード例 #9
0
        public LocalList <IPsiSourceFile> GetPossibleFilesWithUsage(ITypeElement declaredElement)
        {
            var guid = GetGuidFor(declaredElement);

            if (guid == null)
            {
                return(new LocalList <IPsiSourceFile>());
            }

            var result = new LocalList <IPsiSourceFile>();

            foreach (var assetUsage in myAssetUsages.GetValues(guid))
            {
                var location   = assetUsage.Location.OwnerId;
                var sourceFile = myPersistentIndexManager[location];
                if (sourceFile != null)
                {
                    result.Add(sourceFile);
                }
            }

            return(result);
        }
コード例 #10
0
        public bool IsIndexResultEstimated(string ownerGuid, ITypeElement containingType, IEnumerable <string> possibleNames)
        {
            myShellLocks.AssertReadAccessAllowed();

            // TODO: prefab modifications
            // TODO: drop daemon dependency and inject compoentns in consructor
            var configuration = containingType.GetSolution().GetComponent <SolutionAnalysisConfiguration>();

            if (configuration.Enabled.Value && configuration.CompletedOnceAfterStart.Value && configuration.Loaded.Value)
            {
                var service = containingType.GetSolution().GetComponent <SolutionAnalysisService>();
                var id      = service.GetElementId(containingType);
                if (id.HasValue && service.UsageChecker is IGlobalUsageChecker checker)
                {
                    // no inheritors
                    if (checker.GetDerivedTypeElementsCount(id.Value) == 0)
                    {
                        return(false);
                    }
                }
            }

            var count = 0;

            foreach (var possibleName in possibleNames)
            {
                var values = myNameToGuids.GetValues(possibleName);
                count += values.Length;
                if (values.Length == 1 && !values[0].Equals(ownerGuid))
                {
                    count++;
                }
            }

            return(count > 1);
        }