• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CSharpSyntaxGenerator.Field类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CSharpSyntaxGenerator.Field的典型用法代码示例。如果您正苦于以下问题:C# Field类的具体用法?C# Field怎么用?C# Field使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Field类属于CSharpSyntaxGenerator命名空间,在下文中一共展示了Field类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: IsValueField

 private bool IsValueField(Field field)
 {
     return !IsNodeOrNodeList(field.Type);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:4,代码来源:SourceWriter.cs


示例2: IsAutoCreatableNode

 private bool IsAutoCreatableNode(Node node, Field field)
 {
     var referencedNode = GetNode(field.Type);
     return (referencedNode != null && RequiredFactoryArgumentCount(referencedNode) == 0);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:5,代码来源:SourceWriter.cs


示例3: IsRequiredFactoryField

 private bool IsRequiredFactoryField(Node node, Field field)
 {
     return (!IsOptional(field) && !IsAnyList(field.Type) && !CanBeAutoCreated(node, field)) || IsValueField(field);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:4,代码来源:SourceWriter.cs


示例4: OverrideOrNewModifier

 protected static string OverrideOrNewModifier(Field field)
 {
     return IsOverride(field) ? "override " : IsNew(field) ? "new " : "";
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:AbstractFileWriter.cs


示例5: IsAutoCreatableToken

 private bool IsAutoCreatableToken(Node node, Field field)
 {
     return field.Type == "SyntaxToken"
         && field.Kinds != null
         && ((field.Kinds.Count == 1 && field.Kinds[0].Name != "IdentifierToken" && !field.Kinds[0].Name.EndsWith("LiteralToken", StringComparison.Ordinal)) || (field.Kinds.Count > 1 && field.Kinds.Count == node.Kinds.Count));
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:6,代码来源:SourceWriter.cs


示例6: CanAutoConvertFromString

 private bool CanAutoConvertFromString(Field field)
 {
     return IsIdentifierToken(field) || IsIdentifierNameSyntax(field);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:4,代码来源:SourceWriter.cs


示例7: IsIdentifierNameSyntax

 private bool IsIdentifierNameSyntax(Field field)
 {
     return field.Type == "IdentifierNameSyntax";
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:4,代码来源:SourceWriter.cs


示例8: IsNew

 protected static bool IsNew(Field f)
 {
     return f.New != null && string.Compare(f.New, "true", true) == 0;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:AbstractFileWriter.cs


示例9: ChooseValidKind

 //guess a reasonable kind if there are no constraints
 private static string ChooseValidKind(Field field)
 {
     return field.Kinds.Any() ? field.Kinds[0].Name : "IdentifierToken";
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:5,代码来源:TestWriter.cs


示例10: IsOverride

 protected static bool IsOverride(Field f)
 {
     return f.Override != null && string.Compare(f.Override, "true", true) == 0;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:AbstractFileWriter.cs


示例11: IsInternal

 protected static bool IsInternal(Field f)
 {
     return f.Internal != null && string.Compare(f.Internal, "true", true) == 0;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:AbstractFileWriter.cs


示例12: GetFieldType

 protected static string GetFieldType(Field field)
 {
     if (IsAnyList(field.Type))
         return "CSharpSyntaxNode";
     return field.Type;
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:6,代码来源:AbstractFileWriter.cs


示例13: CanBeField

 protected static bool CanBeField(Field field)
 {
     return field.Type != "SyntaxToken" && !IsAnyList(field.Type) && !IsOverride(field) && !IsNew(field);
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:AbstractFileWriter.cs


示例14: AccessibilityModifier

 protected static string AccessibilityModifier(Field field)
 {
     return IsInternal(field) ? "internal" : "public";
 }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:4,代码来源:AbstractFileWriter.cs


示例15: GetRedPropertyType

 private string GetRedPropertyType(Field field)
 {
     if (field.Type == "SyntaxList<SyntaxToken>")
         return "SyntaxTokenList";
     return field.Type;
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:6,代码来源:SourceWriter.cs


示例16: WriteRedListHelperMethods

 private void WriteRedListHelperMethods(Node node, Field field)
 {
     var argType = GetElementType(field.Type);
     WriteLine();
     WriteLine("    public {0} Add{1}(params {2}[] items)", node.Name, field.Name, argType);
     WriteLine("    {");
     WriteLine("        return this.With{0}(this.{1}.AddRange(items));", StripPost(field.Name, "Opt"), field.Name);
     WriteLine("    }");
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:9,代码来源:SourceWriter.cs


示例17: GetDefaultValue

        private string GetDefaultValue(Node nd, Field field)
        {
            System.Diagnostics.Debug.Assert(!IsRequiredFactoryField(nd, field));

            if (IsOptional(field) || IsAnyList(field.Type))
            {
                return string.Format("default({0})", GetRedPropertyType(field));
            }
            else if (field.Type == "SyntaxToken")
            {
                // auto construct token?
                if (field.Kinds.Count == 1)
                {
                    return string.Format("SyntaxFactory.Token(SyntaxKind.{0})", field.Kinds[0].Name);
                }
                else
                {
                    return string.Format("SyntaxFactory.Token(Get{0}{1}Kind(kind))", StripPost(nd.Name, "Syntax"), StripPost(field.Name, "Opt"));
                }
            }
            else
            {
                var referencedNode = GetNode(field.Type);
                return string.Format("SyntaxFactory.{0}()", StripPost(referencedNode.Name, "Syntax"));
            }
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:26,代码来源:SourceWriter.cs


示例18: WriteRedNestedListHelperMethods

        private void WriteRedNestedListHelperMethods(Node node, Field field, Node referencedNode, Field referencedNodeField)
        {
            var argType = GetElementType(referencedNodeField.Type);

            // AddBaseListTypes
            WriteLine();
            WriteLine("    public {0} Add{1}{2}(params {3}[] items)", node.Name, StripPost(field.Name, "Opt"), referencedNodeField.Name, argType);
            WriteLine("    {");

            if (IsOptional(field))
            {
                var factoryName = StripPost(referencedNode.Name, "Syntax");
                var varName = StripPost(CamelCase(field.Name), "Opt");
                WriteLine("        var {0} = this.{1} ?? SyntaxFactory.{2}();", varName, field.Name, factoryName);
                WriteLine("        return this.With{0}({1}.With{2}({1}.{3}.AddRange(items)));", StripPost(field.Name, "Opt"), varName, StripPost(referencedNodeField.Name, "Opt"), referencedNodeField.Name);
            }
            else
            {
                WriteLine("        return this.With{0}(this.{1}.With{2}(this.{1}.{3}.AddRange(items)));", StripPost(field.Name, "Opt"), field.Name, StripPost(referencedNodeField.Name, "Opt"), referencedNodeField.Name);
            }

            WriteLine("    }");
        }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:23,代码来源:SourceWriter.cs


示例19: IsIdentifierToken

 private bool IsIdentifierToken(Field field)
 {
     return field.Type == "SyntaxToken" && field.Kinds != null && field.Kinds.Count == 1 && field.Kinds[0].Name == "IdentifierToken";
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:4,代码来源:SourceWriter.cs


示例20: CanBeAutoCreated

 protected bool CanBeAutoCreated(Node node, Field field)
 {
     return IsAutoCreatableToken(node, field) || IsAutoCreatableNode(node, field);
 }
开发者ID:XieShuquan,项目名称:roslyn,代码行数:4,代码来源:SourceWriter.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CSharpSyntaxGenerator.Node类代码示例发布时间:2022-05-24
下一篇:
C# CSharpLogic.Var类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap