public ContainerRegistrationAnalysisStageProcess(IDaemonProcess process, IContextBoundSettingsStore settingsStore, ITypeUsageManager typeUsageManager, IPatternManager patternManager)
 {
     this.process = process;
     this.settingsStore = settingsStore;
     this.typeUsageManager = typeUsageManager;
     this.patternManager = patternManager;
 }
Exemple #2
0
	    /// <summary>
	    /// Creates a code analysis process corresponding to this stage for analysing a file.
	    /// </summary>
	    /// <returns>Code analysis process to be executed or <c>null</c> if this stage is not available for this file.</returns>
	    public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind) {
		    var t4File = process.SourceFile.GetTheOnlyPsiFile(T4Language.Instance) as IT4File;
			if (t4File == null)
				return EmptyList<IDaemonStageProcess>.InstanceList;

		    return new[] { CreateProcess(process, t4File) };
	    }
        /// <summary>
        /// This method provides a <see cref="IDaemonStageProcess"/> instance which is assigned to highlighting a single document
        /// </summary>
        public IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind kind)
        {
            if (process == null)
            throw new ArgumentNullException("process");

              return new InjectionHappyDetectorDaemonStageProcess(process, settings.GetValue((InjectionHappyDetectorSettings s) => s.MaximumParameters));
        }
        /// <summary>
        /// This method provides a <see cref="IDaemonStageProcess"/> instance which is assigned to highlighting a single document.
        /// </summary>
        protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind, ICSharpFile file)
        {
            if (process == null)
                throw new ArgumentNullException("process");

            return new CloneDetectionDaemonStageProcess(process);
        }
        /// <summary>
        /// This method provides a <see cref="IDaemonStageProcess"/> instance which is assigned to highlighting a single document
        /// </summary>
        public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind kind)
        {
            if (process == null)
                throw new ArgumentNullException("process");

            return new List<IDaemonStageProcess> { new ComplexityAnalysisDaemonStageProcess(process, 0) };
        }
 /// <summary>
 /// Provides an <see cref="IDaemonStageProcess"/> instance which is assigned to
 /// highlighting a single document
 /// </summary>
 public IDaemonStageProcess CreateProcess(IDaemonProcess process) {
     if (process == null) {
         throw new ArgumentNullException("process");
     }
     Logger.LogMessage("NHibernatePlugin: MappingFileAnalysisDaemonStage.CreateProcess called");
     return new MappingFileAnalysisDaemonStageProcess(process);
 }
        public IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
        {
            if (process == null)
                throw new ArgumentNullException("process");

            return new MakeEnumComparisonTypeSafeDaemonStageProcess(process);
        }
        public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
        {
            IFile psiFile = process.SourceFile.GetTheOnlyPsiFile(RazorCSharpLanguage.Instance);
            if (psiFile == null)
                return Enumerable.Empty<IDaemonStageProcess>();

            return new[] { new UseOfSemicolonLiteralInRazorSyntaxDaemonProcess(process) };
        }
        public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
        {
            IFile psiFile = process.SourceFile.GetNonInjectedPsiFile(JavaScriptLanguage.Instance);
            if (psiFile == null)
                yield return null;

            yield return new DaemonStageProcess(process);
        }
    public IFileStructure Run(IDaemonProcess process, IPsiSourceFile psiSourceFile, IContextBoundSettingsStore settingsStore, IFile file)
    {
      var psiFile = file as IPsiFile;
      if (psiFile == null)
        return null;

      return new PsiFileStructure(psiFile, settingsStore);
    }
    public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
    {
      IFile psiFile = process.SourceFile.GetNonInjectedPsiFile<CSharpLanguage>();
      if (psiFile == null)
        return Enumerable.Empty<IDaemonStageProcess>();

      return new [] { new UseInt16MaxValueLiteralDaemonProcess(process) };
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="DaemonStageProcess"/> class.
 /// </summary>
 /// <param name="process">The process.</param>
 public DaemonStageProcess(IDaemonProcess process)
     : base(process)
 {
     this.stringEmptyAnalyzer = new StringEmptyAnalyzer(this.DaemonProcess.Solution);
       this.returnAnalyzer = new ReturnAnalyzer(this.DaemonProcess.Solution);
       this.documentThrownExceptionAnalyzer = new DocumentThrownExceptionAnalyzer(this.DaemonProcess.Solution);
       this.valueAnalysisAnalyzer = new ValueAnalysisAnalyzer(this.DaemonProcess.Solution);
 }
 public DaemonStageProcess(IDaemonProcess process, SearchDomainFactory searchDomainFactory, ICSharpFile csFile)
 {
     this.searchDomainFactory = searchDomainFactory;
     this.csFile = csFile;
     DaemonProcess = process;
     usages = process.GetStageProcess<CollectUsagesStageProcess>();
     Assertion.Assert(usages != null, "usages != null");
 }
        public ContainerRegistrationAnalysisStageProcess(IDaemonProcess process, IContextBoundSettingsStore settingsStore, ITypeUsageManager typeUsageManager, SolutionAnalyzer solutionAnalyzer)
        {
            this.process = process;
            this.settingsStore = settingsStore;
            this.typeUsageManager = typeUsageManager;

            cachedComponentRegistrations = solutionAnalyzer.Analyze().ToList();
        }
 public override IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
 {
   if (!IsSupported(process.SourceFile))
   {
     return EmptyList<IDaemonStageProcess>.InstanceList;
   }
   return new List<IDaemonStageProcess> { new IdentifierHighlighterProcess(process, settings) };
 }
        /// <summary>
        /// Initializes a new instance of the StyleCopStageProcess class, using the specified <see cref="IDaemonProcess"/> .
        /// </summary>
        /// <param name="daemonProcess">
        /// <see cref="IDaemonProcess"/> to execute within. 
        /// </param>
        public StyleCopStageProcess(IDaemonProcess daemonProcess)
        {
            StyleCopTrace.In(daemonProcess);

            this.daemonProcess = daemonProcess;
            InitialiseTimers();

            StyleCopTrace.Out();
        }
        public IDaemonStageProcess CreateProcess(IDaemonProcess process, DaemonProcessKind processKind)
#endif
        {
#if RESHARPER_70
            return new[] { new AnnotationDaemonStageProcess(process) };
#else
            return new AnnotationDaemonStageProcess(process);
#endif
        }
    public InspectionsProcess(IDaemonProcess process, IContextBoundSettingsStore settings)
      : base(process, settings)
    {
      process.SourceFile.PrimaryPsiLanguage.Is<PsiLanguage>();
      process.GetStageProcess<PsiFileIndexProcess>();

      myDeclarations = new Dictionary<string, List<IDeclaration>>();
      VisitFile(process.SourceFile.GetPsiFile<PsiLanguage>(new DocumentRange(process.SourceFile.Document, 0)) as IPsiFile);
    }
        public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
        {
            if (process == null)
                throw new ArgumentNullException("process");

            return new[]
               {
                 new FakeDaemonStageProcess(process)
               };
        }
        public BaseProcessorDaemonStageProcess(IXmlFile file, IDaemonProcess process)
        {
            if (file == null)
                throw new ArgumentNullException("file");
            if (process == null)
                throw new ArgumentNullException("process");

            this.file = file;
            this.process = process;
        }
        public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
        {
            if (process == null)
                throw new ArgumentNullException("process");

            return new[]
               {
                 new MockMetricsDaemonStageProcess(process, settings.GetValue((MockMetricsSettings s) => s.ArrangeAmount))
               };
        }
 protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
     DaemonProcessKind processKind, ICSharpFile file)
 {
     if (processKind == DaemonProcessKind.VISIBLE_DOCUMENT &&
         settings.GetValue(HighlightingSettingsAccessor.ColorUsageHighlightingEnabled))
     {
         return new UnityColorHighlighterProcess(process, settings, file);
     }
     return null;
 }
        public override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
        {
            if (!IsSupported(process.SourceFile))
                return null;

            var collectUsagesStageProcess = process.GetStageProcess<CollectUsagesStageProcess>();
            var typeUsageManager = new TypeUsageManager(collectUsagesStageProcess);

            return new ContainerRegistrationAnalysisStageProcess(process, settings, typeUsageManager, solutionAnalyzer);
        }
        public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
        {
            if (!IsSupported(process.SourceFile))
                return Enumerable.Empty<IDaemonStageProcess>();

            process.SourceFile.GetPsiServices().Files.AssertAllDocumentAreCommitted();

            return process.SourceFile.GetPsiFiles<AngularJsLanguage>()
                .SelectNotNull(file => CreateProcess(process, settings, processKind, (IJavaScriptFile)file));
        }
 public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process,
     IContextBoundSettingsStore settings, DaemonProcessKind processKind)
 {
     if (process == null)
         throw new ArgumentNullException("process");
     return new[]
     {
         new DisposableFunctionDaemonStageProcess(process,
             settings.GetValue((DisposePluginSettings s) => s.MaxLevel))
     };
 }
    public override IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind)
    {
      if (!IsSupported(process.SourceFile))
        return EmptyList<IDaemonStageProcess>.InstanceList;

      var factory = myServices.TryGetService<IPsiInspectionsProcessFactory>(process.SourceFile.LanguageType);
      if (factory == null)
        return EmptyList<IDaemonStageProcess>.InstanceList;

      return new List<IDaemonStageProcess> { factory.CreateInspectionsProcess(process, settings) };
    }
    /// <summary>
    /// This method provides a <see cref="IDaemonStageProcess"/> instance which is assigned to highlighting a single document
    /// </summary>
    public IEnumerable<IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind kind)
    {
      if (process == null)
        throw new ArgumentNullException("process");

      return new[]
               {
                 new ComplexityAnalysisDaemonStageProcess(
                   process, settings.GetValue((ComplexityAnalysisSettings s) => s.Threshold))
               };
    }
        protected override IDaemonStageProcess CreateProcess(
        IDaemonProcess process,
        IContextBoundSettingsStore settings,
        DaemonProcessKind processKind,
        ICSharpFile file)
        {
            var testFile = file.ToTestFile();
              if (testFile == null)
            return null;

              return new TestFileDaemonStageProcess(process, testFile, _testFileAnalyzers);
        }
Exemple #29
0
        ///<summary>
        ///
        ///            Creates a code analysis process corresponding to this stage for analysing a file.
        ///            
        ///</summary>
        ///
        ///<returns>
        ///Code analysis process to be executed or 
        ///<c>null</c> if this stage is not available for this file.
        ///</returns>
        ///
        public IDaemonStageProcess CreateProcess(IDaemonProcess process)
        {
            if (process == null)
                throw new ArgumentNullException("process");

            IXmlFile xmlFile = GetXmlFile(process.ProjectFile);

            if (xmlFile == null)
                return null;

            return CreateProcess(process, xmlFile);
        }
        /// <summary>
        /// Initializes a new instance of the StyleCopStageProcess class, using the specified <see cref="IDaemonProcess"/> .
        /// </summary>
        /// <param name="lifetime">
        /// The <see cref="Lifetime"/> of the owning <see cref="IDaemonProcess"/>
        /// </param>
        /// <param name="apiPool">
        /// A reference to the StyleCop runner.
        /// </param>
        /// <param name="daemon">
        /// A reference to the <see cref="IDaemon"/> manager.
        /// </param>
        /// <param name="daemonProcess">
        /// <see cref="IDaemonProcess"/> to execute within. 
        /// </param>
        /// <param name="threading">
        /// A reference to the <see cref="IThreading"/> instance for timed actions.
        /// </param>
        /// <param name="file">
        /// The file to analyze.
        /// </param>
        public StyleCopStageProcess(Lifetime lifetime, StyleCopApiPool apiPool, IDaemon daemon, IDaemonProcess daemonProcess, IThreading threading, ICSharpFile file)
        {
            StyleCopTrace.In(daemonProcess, file);

            this.lifetime = lifetime;
            this.apiPool = apiPool;
            this.daemon = daemon;
            this.daemonProcess = daemonProcess;
            this.threading = threading;
            this.file = file;

            StyleCopTrace.Out();
        }
Exemple #31
0
 public ProjectAnalysisDaemonStageProcess(IDaemonProcess daemonProcess, IContextBoundSettingsStore settings, ICSharpFile csharpFile)
     : base(daemonProcess, csharpFile)
 {
     _myDaemonProcess = daemonProcess;
     _settings        = settings;
 }
Exemple #32
0
 protected NTriplesIncrementalDaemonStageProcessBase(IDaemonProcess process, IContextBoundSettingsStore settingsStore)
     : base(process, settingsStore)
 {
     this.mySettingsStore = settingsStore;
 }
 public ProjectAnalysisElementProcessor(ProjectAnalysisDaemonStageProcess stageProcess, IDaemonProcess process, IContextBoundSettingsStore settings)
 {
     _highlightingConsumer = new FilteringHighlightingConsumer(stageProcess, settings, stageProcess.File);
     _process  = process;
     _settings = settings;
 }
 protected abstract IDaemonStageProcess CreateStageProcess([NotNull] IFSharpFile fsFile,
                                                           IContextBoundSettingsStore settings, [NotNull] IDaemonProcess process);
 protected CgDaemonStageProcessBase(IDaemonProcess daemonProcess, ICgFile file)
Exemple #36
0
 public override SyntaxHighlightingStageProcess CreateProcess(IDaemonProcess process,
                                                              IContextBoundSettingsStore settings,
                                                              IFile getPrimaryPsiFile)
 {
     return(null);
 }
 protected virtual IDaemonStageProcess GetProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
                                                  DaemonProcessKind processKind, ICSharpFile file)
 {
     return(new PerformanceCriticalCodeAnalysisProcess(process, file, CallGraphSwaExtension, Swa, Tracker, PerformanceAnalyzer, ExpensiveAnalyzer));
 }
 public abstract IEnumerable <IDaemonStageProcess> CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind);
Exemple #39
0
        /// <summary>
        /// Initializes a new instance of the StyleCopStageProcess class, using the specified <see cref="IDaemonProcess"/> .
        /// </summary>
        /// <param name="lifetime">
        /// The <see cref="Lifetime"/> of the owning <see cref="IDaemonProcess"/>
        /// </param>
        /// <param name="apiPool">
        /// A reference to the StyleCop runner.
        /// </param>
        /// <param name="daemon">
        /// A reference to the <see cref="IDaemon"/> manager.
        /// </param>
        /// <param name="daemonProcess">
        /// <see cref="IDaemonProcess"/> to execute within.
        /// </param>
        /// <param name="threading">
        /// A reference to the <see cref="IThreading"/> instance for timed actions.
        /// </param>
        /// <param name="settings">
        /// The current settings.
        /// </param>
        /// <param name="file">
        /// The file to analyze.
        /// </param>
        public StyleCopStageProcess(Lifetime lifetime, StyleCopApiPool apiPool, IDaemon daemon, IDaemonProcess daemonProcess, IThreading threading, IContextBoundSettingsStore settings, ICSharpFile file)
        {
            StyleCopTrace.In(daemonProcess, file);

            this.lifetime      = lifetime;
            this.apiPool       = apiPool;
            this.daemon        = daemon;
            this.daemonProcess = daemonProcess;
            this.threading     = threading;
            this.settings      = settings;
            this.file          = file;

            StyleCopTrace.Out();
        }
Exemple #40
0
 public TestFileAnalysisElementProcessor(TestFileAnalysisDaemonStageProcess stageProcess, IDaemonProcess process, IContextBoundSettingsStore settings)
 {
     _highlightingConsumer = new FilteringHighlightingConsumer(stageProcess.File.GetSourceFile(), stageProcess.File, settings);
     _process  = process;
     _settings = settings;
 }
Exemple #41
0
 protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings, DaemonProcessKind processKind, ICSharpFile file)
Exemple #42
0
 public IdentifierHighlightingProcess(IDaemonProcess process, IYamlFile file, ResolveHighlighterRegistrar resolveHighlighterRegistrar)
     : base(process, file)
 {
     myResolveProblemHighlighter = new ResolveProblemHighlighter(resolveHighlighterRegistrar);
     myReferenceProvider         = ((IFileImpl)file).ReferenceProvider;
 }
Exemple #43
0
 protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
                                                      DaemonProcessKind processKind, IYamlFile file)
 {
     return(new IdentifierHighlightingProcess(process, file, myRegistrar));
 }
Exemple #44
0
 protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
                                                      DaemonProcessKind processKind, IShaderLabFile file)
 {
     return(new ShaderLabErrorStageProcess(process, processKind, myElementProblemAnalyzerRegistrar, settings, file));
 }
Exemple #45
0
 public ComplexityAnalysisDaemonStageProcess(IDaemonProcess daemonProcess, int threshold)
 {
     myDaemonProcess = daemonProcess;
     myThreshold     = threshold;
     //GraphLoader.InvokeLoadGrapFromCoreEvent += GetGraphs;
 }
 protected RiderSyntaxHighlightingProcessBase([NotNull] IDaemonProcess process, [NotNull] IContextBoundSettingsStore settingsStore, [NotNull] IFile file)
 {
     mySettingsStore = settingsStore;
     DaemonProcess   = process;
     File            = file;
 }
Exemple #47
0
 public MethodNameMismatchPatternHighlightingRecursiveElementProcessor(IDaemonProcess daemonProcess)
 {
     _daemonProcess = daemonProcess;
 }
Exemple #48
0
 protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IT4File file)
 => new T4ErrorProcess(file, process, _directiveInfoManager);
Exemple #49
0
        /// <summary>
        /// This method provides a <see cref="IDaemonStageProcess"/> instance which is assigned to highlighting a single document.
        /// </summary>
        /// <param name="process">
        /// Current Daemon Process.
        /// </param>
        /// <param name="settingsStore">
        /// The settingsStore store to use.
        /// </param>
        /// <param name="processKind">
        /// The process kind.
        /// </param>
        /// <param name="file">
        /// The file to analyze.
        /// </param>
        /// ///
        /// <returns>
        /// The current <see cref="IDaemonStageProcess"/>.
        /// </returns>
        protected override IDaemonStageProcess CreateProcess(
            IDaemonProcess process, IContextBoundSettingsStore settingsStore, DaemonProcessKind processKind, ICSharpFile file)
        {
            StyleCopTrace.In(process, settingsStore, processKind, file);

            if (process == null)
            {
                throw new ArgumentNullException("process");
            }

            try
            {
                if (processKind == DaemonProcessKind.OTHER)
                {
                    StyleCopTrace.Info("ProcessKind Other.");
                    StyleCopTrace.Out();
                    return(null);
                }

                if (!this.IsAnalysisEnabled(settingsStore, file))
                {
                    StyleCopTrace.Info("Analysis disabled.");
                    StyleCopTrace.Out();
                    return(null);
                }

                if (!this.IsSupported(process.SourceFile))
                {
                    StyleCopTrace.Info("File type not supported.");
                    StyleCopTrace.Out();
                    return(null);
                }

                if (!this.FileIsValid(file))
                {
                    StyleCopTrace.Info("Source file not valid.");
                    StyleCopTrace.Out();
                    return(null);
                }

                if (!settingsStore.GetValue <StyleCopOptionsSettingsKey, bool>(key => key.AnalyzeReadOnlyFiles))
                {
                    if (process.SourceFile.Properties.IsNonUserFile)
                    {
                        StyleCopTrace.Info("Not analysing non user files.");
                        StyleCopTrace.Out();
                        return(null);
                    }
                }

                IDaemon daemon = file.GetSolution().GetComponent <IDaemon>();

                return
                    (StyleCopTrace.Out(
                         new StyleCopStageProcess(
                             this.lifetime,
                             this.apiPool,
                             daemon,
                             process,
                             this.threading,
                             settingsStore,
                             file)));
            }
            catch (OperationCanceledException)
            {
                return(null);
            }
        }
Exemple #50
0
 public SpringDaemonProcess(IDaemonProcess process, SpringFile file)
 {
     myFile        = file;
     DaemonProcess = process;
 }
 protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
                                                      DaemonProcessKind processKind, IShaderLabFile file)
 {
     return(new IdentifierHighlighterProcess(process, myRegistrar, settings, processKind, file, myIdentifierHighlightingStageService, myInternalMode));
 }
Exemple #52
0
 protected override IDaemonStageProcess CreateDaemonProcess(IDaemonProcess process, DaemonProcessKind processKind, SpringFile file,
                                                            IContextBoundSettingsStore settingsStore)
 {
     return(new SpringDaemonProcess(process, file));
 }
 public T4CSharpErrorProcess(IDaemonProcess process, IContextBoundSettingsStore settingsStore, ICSharpFile file)
     : base(process, settingsStore, file)
 {
 }
        public static void CreateInefficientMultidimensionalArrayAccessWarning([CanBeNull] IDeclaredElement declaredElement,
                                                                               [NotNull] IVariableDeclaration variableDeclaration, [NotNull]  IDaemonProcess daemonProcess, [NotNull]  DaemonProcessKind kind,
                                                                               [NotNull] IHighlightingConsumer consumer, [NotNull] DocumentRange highlightingRange)
        {
            if (declaredElement == null)
            {
                return;
            }

            var type = variableDeclaration.Type as IArrayType;

            if (type == null)
            {
                return;
            }

            if (type.Rank == 1)
            {
                return;
            }

            IArrayCreationExpression arrayCreationExpression = null;
            IMultipleDeclaration     multipleDeclaration     = null;

            switch (variableDeclaration)
            {
            case IFieldDeclaration fieldDeclaration:
                // perfomance optimization
                if (fieldDeclaration.GetAccessRights() != AccessRights.PRIVATE)
                {
                    return;
                }

                arrayCreationExpression = (fieldDeclaration.Initial as IExpressionInitializer)?.Value as IArrayCreationExpression;
                multipleDeclaration     = MultipleFieldDeclarationNavigator.GetByDeclarator(fieldDeclaration);

                break;

            case ILocalVariableDeclaration localVariableDeclaration:
                var initial = localVariableDeclaration.Initial;
                arrayCreationExpression = (initial as IExpressionInitializer)?.Value as IArrayCreationExpression;

                if (initial != null && arrayCreationExpression == null)
                {
                    return;
                }

                multipleDeclaration =
                    MultipleLocalVariableDeclarationNavigator.GetByDeclarator(localVariableDeclaration);
                break;

            default:
                return;
            }

            var classDeclaration = variableDeclaration.GetContainingNode <IClassLikeDeclaration>();

            if (classDeclaration == null)
            {
                return;
            }

            var usages = FindArrayUsages(declaredElement, classDeclaration, daemonProcess, kind);

            foreach (var usage in usages)
            {
                if (ElementAccessExpressionNavigator.GetByOperand(usage as ICSharpExpression) == null)
                {
                    return;
                }
            }

            if (arrayCreationExpression.ContainsErrorElement())
            {
                return;
            }

            consumer.AddHighlighting(new InefficientMultidimensionalArrayUsageWarning(usages.Select(t => t.CreateTreeElementPointer()).ToList(),
                                                                                      arrayCreationExpression, variableDeclaration, multipleDeclaration, highlightingRange));
        }
Exemple #55
0
 public AnnotationDaemonStageProcess(IDaemonProcess process)
 {
     DaemonProcess = process;
 }
 protected override IDaemonStageProcess CreateProcess(IDaemonProcess process, IContextBoundSettingsStore settings,
                                                      DaemonProcessKind processKind, IJavaScriptFile file)
 {
     return(new AngularJsIdentifierHighlighterProcess(resolveHighlighterRegistrar, process, settings, file, processKind));
 }
 public SmartResolverProcess(IDaemonProcess daemonProcess)
 {
     myDaemonProcess = daemonProcess;
 }
 public ShaderLabSyntaxHighlightingProcess([NotNull] IDaemonProcess process,
                                           [NotNull] IContextBoundSettingsStore settingsStore, [NotNull] IFile file)
     : base(process, settingsStore, file)
 {
 }
 public MockMetricsElementProcessor(IDaemonProcess process)
 {
     _eater         = EatingRoot.Instance.GetUnitTestEater();
     _process       = process;
     _highlightings = new List <HighlightingInfo>();
 }
        private static List <ITreeNode> FindArrayUsages(IDeclaredElement declaredElement, IClassLikeDeclaration container, IDaemonProcess daemonProcess, DaemonProcessKind processKind)
        {
            var result = new List <ITreeNode>();

            if (processKind != DaemonProcessKind.GLOBAL_WARNINGS)
            {
                var collectUsagesStageProcess = daemonProcess?.GetStageProcess <CollectUsagesStageProcess>();
                if (collectUsagesStageProcess == null)
                {
                    return(result);
                }

                foreach (var usage in collectUsagesStageProcess.GetDeclaredElementUsages(declaredElement)
                         .Where(container.Contains))
                {
                    result.Add(usage);
                }

                return(result);
            }

            var finder = declaredElement.GetPsiServices().Finder;

            foreach (var reference in finder.FindAllReferences(declaredElement))
            {
                result.Add(reference.GetTreeNode());
            }

            return(result);
        }