protected override void Analyze(IEqualityExpression equalityExpression,
                                 IHighlightingConsumer consumer, IReadOnlyCallGraphContext context)
 {
     if (PerformanceCriticalCodeStageUtil.IsNullComparisonWithUnityObject(equalityExpression, out var name))
     {
         consumer.AddHighlighting(new UnityPerformanceNullComparisonWarning(equalityExpression, name, equalityExpression.Reference.NotNull("eqaulityReference != null")));
     }
 }
 protected override void Analyze(IEqualityExpression equalityExpression, IDaemonProcess daemonProcess, DaemonProcessKind kind,
                                 IHighlightingConsumer consumer)
 {
     if (PerformanceCriticalCodeStageUtil.IsNullComparisonWithUnityObject(equalityExpression, out var name))
     {
         consumer.AddHighlighting(new UnityPerformanceNullComparisonWarning(equalityExpression, name, equalityExpression.Reference.NotNull("eqaulityReference != null")));
     }
 }
示例#3
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);
        }