Exemplo n.º 1
0
        protected override void Analyze(IInvocationExpression expression, IDaemonProcess daemonProcess, DaemonProcessKind kind,
                                        IHighlightingConsumer consumer)
        {
            if (PerformanceCriticalCodeStageUtil.IsInvocationExpensive(expression))
            {
                CreateHiglighting(expression, consumer);
            }
            else if (kind == DaemonProcessKind.GLOBAL_WARNINGS)
            {
                var declaredElement = expression.Reference.Resolve().DeclaredElement;
                if (declaredElement == null)
                {
                    return;
                }

                var id = myProvider.GetElementId(declaredElement);
                if (!id.HasValue)
                {
                    return;
                }

                if (mySwaExtensionProvider.IsMarkedByCallGraphAnalyzer(myExpensiveCodeCallGraphAnalyzer.Id, true, id.Value))
                {
                    CreateHiglighting(expression, consumer);
                }
            }
        }
Exemplo n.º 2
0
 public override void ProcessBeforeInterior(ITreeNode element)
 {
     switch (element)
     {
     case IInvocationExpression invocationExpression when
         PerformanceCriticalCodeStageUtil.IsInvocationExpensive(invocationExpression):
     case IReferenceExpression referenceExpression when
         PerformanceCriticalCodeStageUtil.IsCameraMainUsage(referenceExpression):
     {
         ProcessingIsFinished = true;
         break;
     }
     }
 }
        public override LocalList <IDeclaredElement> GetMarkedFunctionsFrom(ITreeNode currentNode, IDeclaredElement containingFunction)
        {
            var result = new LocalList <IDeclaredElement>();

            switch (currentNode)
            {
            case IInvocationExpression invocationExpression when PerformanceCriticalCodeStageUtil.IsInvocationExpensive(invocationExpression):
            case IReferenceExpression referenceExpression when PerformanceCriticalCodeStageUtil.IsCameraMainUsage(referenceExpression):
            case IAttributesOwner attributesOwner when PerformanceCriticalCodeStageUtil.HasPerformanceSensitiveAttribute(attributesOwner):
                result.Add(containingFunction);

                break;
            }

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

            switch (currentNode)
            {
            case IInvocationExpression invocationExpression when PerformanceCriticalCodeStageUtil.IsInvocationExpensive(invocationExpression):
            case IReferenceExpression referenceExpression when PerformanceCriticalCodeStageUtil.IsCameraMainUsage(referenceExpression):
            case IEqualityExpression equalityExpressionParam when PerformanceCriticalCodeStageUtil.IsNullComparisonWithUnityObject(equalityExpressionParam, out _):
            case IFunctionDeclaration functionDeclaration when PerformanceCriticalCodeStageUtil.HasPerformanceSensitiveAttribute(functionDeclaration):
                result.Add(containingFunction);

                break;
            }

            return(result);
        }
 public void ProcessBeforeInterior(ITreeNode element)
 {
     switch (element)
     {
     case IInvocationExpression invocationExpression when
         PerformanceCriticalCodeStageUtil.IsInvocationExpensive(invocationExpression):
     case IReferenceExpression referenceExpression when
         PerformanceCriticalCodeStageUtil.IsCameraMainUsage(referenceExpression):
     case IAttributesOwnerDeclaration attributesOwnerDeclaration when
         attributesOwnerDeclaration.DeclaredElement is IAttributesOwner attributesOwner &&
         PerformanceCriticalCodeStageUtil.HasPerformanceSensitiveAttribute(attributesOwner):
     {
         IsExpensiveCodeFound = true;
         break;
     }
     }
 }