Exemplo n.º 1
0
        public override LocalList <IDeclaredElement> GetMarkedFunctionsFrom(ITreeNode currentNode, IDeclaredElement containingFunction)
        {
            var result = new LocalList <IDeclaredElement>();

            if (currentNode is IMethodDeclaration methodDeclaration)
            {
                if (PerformanceCriticalCodeStageUtil.HasFrequentlyCalledMethodAttribute(methodDeclaration))
                {
                    result.Add(containingFunction);
                }
                else
                if (ourKnownHotMonoBehaviourMethods.Contains(methodDeclaration.DeclaredName))
                {
                    var containingTypeDeclaration = methodDeclaration.GetContainingTypeDeclaration()?.DeclaredElement;

                    if (myUnityApi.IsDescendantOfMonoBehaviour(containingTypeDeclaration))
                    {
                        result.Add(containingFunction);
                    }
                }
            }


            var coroutineOrInvoke = ExtractCoroutineOrInvokeRepeating(currentNode);

            if (coroutineOrInvoke != null)
            {
                result.Add(coroutineOrInvoke);
            }

            return(result);
        }