Ejemplo n.º 1
0
        protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
                                                             DaemonProcessKind processKind, ICSharpFile file)
        {
            if (!file.GetProject().IsUnityProject())
            {
                return(null);
            }

            return(new UnityHighlightingProcess(process, file, HiglightingProviders, API, UnityHighlightingContributor, processKind));
        }
Ejemplo n.º 2
0
        protected override IDaemonStageProcess CreateProcess(IDaemonProcess process,
                                                             IContextBoundSettingsStore settings,
                                                             DaemonProcessKind processKind, ICSharpFile file)
        {
            if (!file.GetProject().IsUnityProject())
            {
                return(null);
            }

            return(new CallGraphProcess(process, processKind, file, myLogger, myContextProviders, myProblemAnalyzers));
        }
Ejemplo n.º 3
0
        protected override IDaemonStageProcess CreateProcess(IDaemonProcess process,
                                                             IContextBoundSettingsStore settings,
                                                             DaemonProcessKind processKind, ICSharpFile file)
        {
            var sourceFile = file.GetSourceFile();

            if (!file.GetProject().IsUnityProject() || !mySwaExtensionProvider.IsApplicable(sourceFile))
            {
                return(null);
            }

            return(new CallGraphProcess(process, processKind, file, myLogger, myContextProviders, myProblemAnalyzers));
        }
        private void AnalyzeFile(ICSharpFile file, IHighlightingConsumer consumer)
        {
            if (!file.GetProject().IsUnityProject())
            {
                return;
            }

            var sourceFile = file.GetSourceFile();

            if (sourceFile == null)
            {
                return;
            }

            file.ProcessThisAndDescendants(this, consumer);
        }
        protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
                                                             DaemonProcessKind processKind, ICSharpFile file)
        {
            if (!file.GetProject().IsUnityProject())
            {
                return(null);
            }

            var enabled = settings.GetValue((UnitySettings s) => s.EnablePerformanceCriticalCodeHighlighting);

            if (!enabled)
            {
                return(null);
            }

            return(GetProcess(process, settings, processKind, file));
        }
        protected override IDaemonStageProcess CreateProcess(IDaemonProcess process,
                                                             IContextBoundSettingsStore settings,
                                                             DaemonProcessKind processKind, ICSharpFile file)
        {
            if (!file.GetProject().IsUnityProject())
            {
                return(null);
            }

            var isPerformanceAnalysisEnabled =
                settings.GetValue((UnitySettings s) => s.EnablePerformanceCriticalCodeHighlighting);


            return(new UnityHighlightingProcess(process, file, myCallGraphSwaExtensionProvider,
                                                myPerformanceCriticalCodeCallGraphMarksProvider, isPerformanceAnalysisEnabled,
                                                HiglightingProviders, PerformanceProblemAnalyzers,
                                                API, myCommonIconProvider, processKind, myProvider, Logger));
        }
Ejemplo n.º 7
0
        private void AnalyzeFile(ICSharpFile file, IHighlightingConsumer consumer)
        {
            if (!file.GetProject().IsUnityProject())
            {
                return;
            }

            var sourceFile = file.GetSourceFile();

            if (sourceFile == null)
            {
                return;
            }

            // find hot methods in derived from MonoBehaviour classes.
            var hotRootMethods = FindHotRootMethods(file, sourceFile);

            if (hotRootMethods.Count == 0)
            {
                return;
            }
            myCheckForInterrupt();

            var context = GetHotMethodAnalyzerContext(consumer, hotRootMethods, sourceFile);

            myCheckForInterrupt();

            // Second step of propagation 'costly reachable mark'. Handles cycles in call graph
            PropagateCostlyReachableMark(context);
            myCheckForInterrupt();

            // highlight hot methods
            foreach (var hotMethodDeclaration in context.HotMethods)
            {
                HighlightHotMethod(hotMethodDeclaration, consumer);
            }

            // highlight all invocation which indirectly calls costly methods.
            // it is fast, because we have already calculated all data
            HighlightCostlyReachableInvocation(consumer, context);
        }
        private void AnalyzeFile(ICSharpFile file, IHighlightingConsumer consumer)
        {
            if (myProcessKind != DaemonProcessKind.VISIBLE_DOCUMENT && myProcessKind != DaemonProcessKind.SOLUTION_ANALYSIS)
            {
                return;
            }

            if (!file.GetProject().IsUnityProject())
            {
                return;
            }

            var sourceFile = file.GetSourceFile();

            if (sourceFile == null)
            {
                return;
            }

            // find hot methods in derived from MonoBehaviour classes.
            var hotRootMethods = FindHotRootMethods(file, sourceFile);

            if (hotRootMethods.Count == 0)
            {
                return;
            }
            ourCheckForInterrupt();

            var context = GetHotMethodAnalyzerContext(consumer, hotRootMethods, sourceFile);

            ourCheckForInterrupt();

            // Second step of propagation 'costly reachable mark'. Handles cycles in call graph
            PropagateCostlyReachableMark(context);
            ourCheckForInterrupt();

            // highlight all invocation which indirectly calls costly methods.
            // it is fast, because we have already calculated all data
            HighlightCostlyReachableInvocation(consumer, context);
        }
Ejemplo n.º 9
0
        public ITestFile Aggregate(ICSharpFile file, [CanBeNull] Func <bool> notInterrupted)
        {
            notInterrupted = notInterrupted ?? (() => true);

            var project = file.GetProject();

            if (project == null)
            {
                return(null);
            }

            var assemblyIdentity         = new Identity(project.GetOutputFilePath().FullPath);
            var testDeclarationProviders = _testDeclarationProviderFactories.Select(x => x.CreateTestDeclarationProvider(assemblyIdentity, project, notInterrupted)).ToList();
            var classDeclarations        = GetClassDeclarations(file).ToList();
            var testDeclarations         = GetTestDeclarations(testDeclarationProviders, classDeclarations).TakeWhile(notInterrupted).WhereNotNull().ToList();

            if (testDeclarations.Count == 0)
            {
                return(null);
            }

            return(new TestFile(testDeclarations, file));
        }
Ejemplo n.º 10
0
        private bool IsAnalysisEnabled(IContextBoundSettingsStore settingsStore, ICSharpFile file)
        {
            var enabled = settingsStore.GetValue <StyleCopOptionsSettingsKey, bool>(key => key.AnalysisEnabled);

            return(enabled && !this.referencedAnalyzersCache.IsAnalyzerReferenced(file.GetProject(), "stylecop.analyzers"));
        }