当前位置: 首页>>代码示例>>C#>>正文


C# CompilationEvent.GetType方法代码示例

本文整理汇总了C#中Microsoft.CodeAnalysis.Diagnostics.CompilationEvent.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# CompilationEvent.GetType方法的具体用法?C# CompilationEvent.GetType怎么用?C# CompilationEvent.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.CodeAnalysis.Diagnostics.CompilationEvent的用法示例。


在下文中一共展示了CompilationEvent.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessEventCore

        private void ProcessEventCore(CompilationEvent e, AnalysisScope analysisScope, AnalysisState analysisStateOpt, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var symbolEvent = e as SymbolDeclaredCompilationEvent;
            if (symbolEvent != null)
            {
                ProcessSymbolDeclared(symbolEvent, analysisScope, analysisStateOpt, cancellationToken);
                return;
            }

            var completedEvent = e as CompilationUnitCompletedEvent;
            if (completedEvent != null)
            {
                ProcessCompilationUnitCompleted(completedEvent, analysisScope, analysisStateOpt, cancellationToken);
                return;
            }

            var endEvent = e as CompilationCompletedEvent;
            if (endEvent != null)
            {
                ProcessCompilationCompleted(endEvent, analysisScope, analysisStateOpt, cancellationToken);
                return;
            }

            var startedEvent = e as CompilationStartedEvent;
            if (startedEvent != null)
            {
                ProcessCompilationStarted(startedEvent, analysisScope, analysisStateOpt, cancellationToken);
                return;
            }

            throw new InvalidOperationException("Unexpected compilation event of type " + e.GetType().Name);
        }
开发者ID:JRobertGit,项目名称:roslyn,代码行数:34,代码来源:AnalyzerDriver.cs

示例2: ProcessEventAsync

        private async Task ProcessEventAsync(CompilationEvent e, CancellationToken cancellationToken)
        {
            var symbolEvent = e as SymbolDeclaredCompilationEvent;
            if (symbolEvent != null)
            {
                await ProcessSymbolDeclared(symbolEvent, cancellationToken).ConfigureAwait(false);
                return;
            }

            var completedEvent = e as CompilationUnitCompletedEvent;
            if (completedEvent != null)
            {
                await ProcessCompilationUnitCompleted(completedEvent, cancellationToken).ConfigureAwait(false);
                return;
            }

            var endEvent = e as CompilationCompletedEvent;
            if (endEvent != null)
            {
                await ProcessCompilationCompletedAsync(endEvent, cancellationToken).ConfigureAwait(false);
                return;
            }

            throw new InvalidOperationException("Unexpected compilation event of type " + e.GetType().Name);
        }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:25,代码来源:AnalyzerDriver.cs

示例3: UpdateEventsMap_NoLock

 private void UpdateEventsMap_NoLock(CompilationEvent compilationEvent, bool add)
 {
     var symbolEvent = compilationEvent as SymbolDeclaredCompilationEvent;
     if (symbolEvent != null)
     {
         // Add/remove symbol events.
         // Any diagnostics request for a tree should trigger symbol and syntax node analysis for symbols with at least one declaring reference in the tree.
         foreach (var location in symbolEvent.Symbol.Locations)
         {
             if (location.SourceTree != null)
             {
                 if (add)
                 {
                     AddPendingSourceEvent_NoLock(location.SourceTree, compilationEvent);
                 }
                 else
                 {
                     RemovePendingSourceEvent_NoLock(location.SourceTree, compilationEvent);
                 }
             }
         }
     }
     else
     {
         // Add/remove compilation unit completed events.
         var compilationUnitCompletedEvent = compilationEvent as CompilationUnitCompletedEvent;
         if (compilationUnitCompletedEvent != null)
         {
             var tree = compilationUnitCompletedEvent.SemanticModel.SyntaxTree;
             if (add)
             {
                 AddPendingSourceEvent_NoLock(tree, compilationEvent);
             }
             else
             {
                 RemovePendingSourceEvent_NoLock(tree, compilationEvent);
             }
         }
         else if (compilationEvent is CompilationStartedEvent || compilationEvent is CompilationCompletedEvent)
         {
             // Add/remove compilation events.
             if (add)
             {
                 _pendingNonSourceEvents.Add(compilationEvent);
             }
             else
             {
                 _pendingNonSourceEvents.Remove(compilationEvent);
             }
         }
         else
         {
             throw new InvalidOperationException("Unexpected compilation event of type " + compilationEvent.GetType().Name);
         }
     }
 }
开发者ID:Excoriate,项目名称:roslyn,代码行数:56,代码来源:AnalysisState.cs

示例4: ProcessEventCoreAsync

        private Task ProcessEventCoreAsync(CompilationEvent e, CancellationToken cancellationToken)
        {
            var symbolEvent = e as SymbolDeclaredCompilationEvent;
            if (symbolEvent != null)
            {
                return ProcessSymbolDeclaredAsync(symbolEvent, cancellationToken);
            }

            var completedEvent = e as CompilationUnitCompletedEvent;
            if (completedEvent != null)
            {
                return ProcessCompilationUnitCompletedAsync(completedEvent, cancellationToken);
            }

            var endEvent = e as CompilationCompletedEvent;
            if (endEvent != null)
            {
                return ProcessCompilationCompletedAsync(endEvent, cancellationToken);
            }

            if (e is CompilationStartedEvent)
            {
                // Ignore CompilationStartedEvent.
                return null;
            }

            throw new InvalidOperationException("Unexpected compilation event of type " + e.GetType().Name);
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:28,代码来源:AnalyzerDriver.cs


注:本文中的Microsoft.CodeAnalysis.Diagnostics.CompilationEvent.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。