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


C# SyntaxNode.GetType方法代码示例

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


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

示例1: GetBlockSpans

        private void GetBlockSpans(SyntaxNode node)
        {
            if (_nodeProviderMap.TryGetValue(node.GetType(), out var providers))
            {
                foreach (var provider in providers)
                {
                    _cancellationToken.ThrowIfCancellationRequested();

                    provider.CollectBlockSpans(_document, node, _spans, _cancellationToken);
                }
            }
        }
开发者ID:TyOverby,项目名称:roslyn,代码行数:12,代码来源:BlockSpanCollector.cs

示例2: GetOutliningSpans

        private void GetOutliningSpans(SyntaxNode node)
        {
            ImmutableArray<AbstractSyntaxNodeOutliner> outliners;
            if (_nodeOutlinerMap.TryGetValue(node.GetType(), out outliners))
            {
                foreach (var outliner in outliners)
                {
                    _cancellationToken.ThrowIfCancellationRequested();

                    outliner.CollectOutliningSpans(_document.Document, node, _regions, _cancellationToken);
                }
            }
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:13,代码来源:RegionCollector.cs

示例3: GetBlockSpans

        private void GetBlockSpans(SyntaxNode node)
        {
            ImmutableArray<AbstractSyntaxStructureProvider> providers;
            if (_nodeProviderMap.TryGetValue(node.GetType(), out providers))
            {
                foreach (var provider in providers)
                {
                    _cancellationToken.ThrowIfCancellationRequested();

                    provider.CollectBlockSpans(_document, node, _spans, _cancellationToken);
                }
            }
        }
开发者ID:jkotas,项目名称:roslyn,代码行数:13,代码来源:BlockSpanCollector.cs

示例4: Visit

 public override void Visit(SyntaxNode node)
 {
     int padding = node.Ancestors().Count();
     //To identify leaf nodes vs nodes with children
     string prepend = node.ChildNodes().Any() ? "[-]"
     : "[.]";
     //Get the type of the node
     string line = new String(' ', padding) + prepend
     + " " + node.GetType().ToString();
     //Write the line
     System.Console.WriteLine(line);
     base.Visit(node);
 }
开发者ID:dotnetcurry,项目名称:roslyn-dncmag-03,代码行数:13,代码来源:Program.cs

示例5: IsEnlargersNesting

 private static bool IsEnlargersNesting(SyntaxNode statementSyntax)
 {
     return TypesIncreaseNesting.Any(type => statementSyntax.GetType() == type);
 }
开发者ID:Wanderer19,项目名称:Tasks,代码行数:4,代码来源:Telyatnikova.cs

示例6: Visit

            // Visits all SyntaxNodes.
            public override void Visit(SyntaxNode node)
            {
                // If you need to visit all SyntaxNodes of a particular base type that can never
                // appear directly in a syntax tree then this would be the place to check for that.
                // For example, TypeDeclarationSyntax is a base type for all the type declarations (like
                // ClassDeclarationSyntax and StructDeclarationSyntax) that can appear in a syntax tree.
                if (node is TypeDeclarationSyntax)
                {
                    Results.AppendLine();
                    Results.Append("Visiting ");
                    Results.Append(node.GetType().Name);
                    Results.Append(" (Kind = ");
                    Results.Append(node.Kind.ToString());
                    Results.Append(")");
                }

                base.Visit(node);
            }
开发者ID:ruslanmalogulko,项目名称:presentations,代码行数:19,代码来源:FAQ.cs

示例7: ThrowUnableToGenerateException

        private static void ThrowUnableToGenerateException(string generationStage, SyntaxNode node)
        {
            string message = string.Format(
                "Unable to generate node type {0} as {1}.",
                node.GetType().Name,
                generationStage);

            throw new CodeGenerationException(message, node.Line, node.Column);
        }
开发者ID:smack0007,项目名称:Snowflake,代码行数:9,代码来源:CodeGenerator.cs

示例8: LogSyntaxTree

        private void LogSyntaxTree(SyntaxNode node, StringBuilder builder, int ident = 0, bool skipSelf = false)
        {
            string sident = String.Empty;
            for (int i = 0; i < ident; ++i)
                sident += "\t";

            if (!skipSelf)
            {
                builder.AppendLine (sident + node.GetType() + ": " + node);
                ident++;
            }

            foreach (SyntaxNode childNode in node.ChildNodes())
                LogSyntaxTree (childNode, builder, ident);
        }
开发者ID:Auxon,项目名称:Instant,代码行数:15,代码来源:MainWindowViewModel.cs


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