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


C# EnumMemberDeclarationSyntax类代码示例

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


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

示例1: SourceEnumConstantSymbol

 protected SourceEnumConstantSymbol(SourceMemberContainerTypeSymbol containingEnum, EnumMemberDeclarationSyntax syntax, DiagnosticBag diagnostics)
     : base(containingEnum, syntax.Identifier.ValueText, syntax.GetReference(), syntax.Identifier.GetLocation())
 {
     if (this.Name == WellKnownMemberNames.EnumBackingFieldName)
     {
         diagnostics.Add(ErrorCode.ERR_ReservedEnumerator, this.Location, WellKnownMemberNames.EnumBackingFieldName);
     }
 }
开发者ID:riversky,项目名称:roslyn,代码行数:8,代码来源:SourceEnumConstantSymbol.cs

示例2: CreateExplicitValuedConstant

 public static SourceEnumConstantSymbol CreateExplicitValuedConstant(
     SourceMemberContainerTypeSymbol containingEnum,
     EnumMemberDeclarationSyntax syntax,
     DiagnosticBag diagnostics)
 {
     var initializer = syntax.EqualsValue;
     Debug.Assert(initializer != null);
     return new ExplicitValuedEnumConstantSymbol(containingEnum, syntax, initializer, diagnostics);
 }
开发者ID:riversky,项目名称:roslyn,代码行数:9,代码来源:SourceEnumConstantSymbol.cs

示例3: VisitEnumMemberDeclaration

        public override void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node)
        {
            var symbol = model.GetDeclaredSymbol(node);
            this.declaredItems.Add(new DeclaredItemDocument
            {
                Name = symbol.Name,
                Location = this.model.SyntaxTree.GetLineSpan(node.Span, false).StartLinePosition.Line,
                Identifier = symbol.ToDisplayString(),
                Type = "EnumMember"

            });
            base.VisitEnumMemberDeclaration(node);
        }
开发者ID:swapneeld,项目名称:SourceCodeReader,代码行数:13,代码来源:CSharpCodeIndexingSyntaxWalker.cs

示例4: CreateImplicitValuedConstant

 public static SourceEnumConstantSymbol CreateImplicitValuedConstant(
     SourceMemberContainerTypeSymbol containingEnum,
     EnumMemberDeclarationSyntax syntax,
     SourceEnumConstantSymbol otherConstant,
     int otherConstantOffset,
     DiagnosticBag diagnostics)
 {
     if ((object)otherConstant == null)
     {
         Debug.Assert(otherConstantOffset == 0);
         return new ZeroValuedEnumConstantSymbol(containingEnum, syntax, diagnostics);
     }
     else
     {
         Debug.Assert(otherConstantOffset > 0);
         return new ImplicitValuedEnumConstantSymbol(containingEnum, syntax, otherConstant, (uint)otherConstantOffset, diagnostics);
     }
 }
开发者ID:riversky,项目名称:roslyn,代码行数:18,代码来源:SourceEnumConstantSymbol.cs

示例5: VisitEnumMemberDeclaration

        public override SyntaxNode VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node)
        {
            if (node.EqualsValue == null)
            {
                lastValue++;
                return node.WithEqualsValue(Syntax.EqualsValueClause(Syntax.Token(SyntaxKind.EqualsToken),
                    Syntax.LiteralExpression(SyntaxKind.NumericLiteralExpression, Syntax.Literal(lastValue))
                    ));
            }
            else
            {
                ExpressionSyntax expr = node.EqualsValue.Value;
                if (expr.Kind == SyntaxKind.NumericLiteralExpression)
                {
                    lastValue = int.Parse(expr.ToString());
                    return node;
                }

                throw new NotImplementedException("enum with non-literal explicit value");
            }

            return base.VisitEnumMemberDeclaration(node);
        }
开发者ID:VendanAndrews,项目名称:ls2csc,代码行数:23,代码来源:EnumValueRewriter.cs

示例6: EnumMemberDeclarationTranslation

 public EnumMemberDeclarationTranslation(EnumMemberDeclarationSyntax syntax, SyntaxTranslation parent) : base(syntax, parent)
 {
 }
开发者ID:asthomas,项目名称:TypescriptSyntaxPaste,代码行数:3,代码来源:EnumMemberDeclarationTranslation.cs

示例7: VisitEnumMemberDeclaration

			public override void VisitEnumMemberDeclaration (EnumMemberDeclarationSyntax node)
			{
				base.VisitEnumMemberDeclaration (node);
				Append (node);
			}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:5,代码来源:CSharpOutlineTextEditorExtension.cs

示例8: ClassifyUpdate

            private void ClassifyUpdate(EnumMemberDeclarationSyntax oldNode, EnumMemberDeclarationSyntax newNode)
            {
                if (!SyntaxFactory.AreEquivalent(oldNode.Identifier, newNode.Identifier))
                {
                    ReportError(RudeEditKind.Renamed);
                    return;
                }

                Debug.Assert(!SyntaxFactory.AreEquivalent(oldNode.EqualsValue, newNode.EqualsValue));
                ReportError(RudeEditKind.InitializerUpdate);
            }
开发者ID:GeertVL,项目名称:roslyn,代码行数:11,代码来源:CSharpEditAndContinueAnalyzer.cs

示例9: VisitEnumMemberDeclaration

 /// <summary>
 /// Traverse AST node that represents enumeration constant declaration
 /// </summary>
 /// <param name="node">AST node.</param>
 public override void VisitEnumMemberDeclaration(EnumMemberDeclarationSyntax node)
 {
     try
     {
         if (!node.Identifier.Span.IsEmpty)
         {
             var symbol = _sm.GetDeclaredSymbol(node);
             if (!_defined.Contains(symbol))
             {
                 _defined.Add(symbol);
                 var def = Def.For(symbol: symbol, type: "enum field", name: symbol.Name).At(_path, node.Identifier.Span);
                 def.Exported = true;
                 AddDef(def);
             }
         }
         base.VisitEnumMemberDeclaration(node);
     }
     catch (Exception e)
     {
     }
 }
开发者ID:ildarisaev,项目名称:srclib-csharp,代码行数:25,代码来源:GraphRunner.cs

示例10: GetDeclaredSymbol

 public override IFieldSymbol GetDeclaredSymbol(EnumMemberDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
 {
     // Can't define member inside member.
     return null;
 }
开发者ID:orthoxerox,项目名称:roslyn,代码行数:5,代码来源:MemberSemanticModel.cs

示例11: GetDeclaredSymbol

 /// <summary>
 /// Given a enum member declaration, get the corresponding field symbol.
 /// </summary>
 /// <param name="declarationSyntax">The syntax node that declares an enum member.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>The symbol that was declared.</returns>
 public override IFieldSymbol GetDeclaredSymbol(EnumMemberDeclarationSyntax declarationSyntax, CancellationToken cancellationToken = default(CancellationToken))
 {
     return (IFieldSymbol)GetDeclaredMemberSymbol(declarationSyntax);
 }
开发者ID:nileshjagtap,项目名称:roslyn,代码行数:10,代码来源:SyntaxTreeSemanticModel.cs

示例12: ExplicitValuedEnumConstantSymbol

 public ExplicitValuedEnumConstantSymbol(
     SourceMemberContainerTypeSymbol containingEnum,
     EnumMemberDeclarationSyntax syntax,
     EqualsValueClauseSyntax initializer,
     DiagnosticBag diagnostics) :
     base(containingEnum, syntax, diagnostics)
 {
     this.equalsValueNodeRef = initializer.GetReference();
 }
开发者ID:riversky,项目名称:roslyn,代码行数:9,代码来源:SourceEnumConstantSymbol.cs

示例13: Add

            public void Add(EnumMemberDeclarationSyntax node)
            {
                /*        // Summary:
                //     Gets the attribute declaration list.
                public SyntaxList<AttributeListSyntax> AttributeLists { get; }
                public EqualsValueClauseSyntax EqualsValue { get; }
                //
                // Summary:
                //     Gets the identifier.
                public SyntaxToken Identifier { get; }
                 */
                // add field info

                TypeExtraInfo tei = Chunk.AddTypeExtraInfo(this.Class,Model);
                tei.AddEnumMember(node.Identifier.ToString(), node.EqualsValue != null ? node.EqualsValue.Value : null);

                /*
                // Summary:
                //     Gets the attribute declaration list.
                public override SyntaxList<AttributeListSyntax> AttributeLists { get; }
                public override VariableDeclarationSyntax Declaration { get; }
                //
                // Summary:
                //     Gets the modifier list.
                public override SyntaxTokenList Modifiers { get; }
                public override SyntaxToken SemicolonToken { get; }
                 */

                // add to metadata for runtime type building
                FlatArrayBuilder fab = new FlatArrayBuilder();

                fab.Add(FlatValue.Int32((int)ClassMemberType.StaticField));
                //TypeInfo ti = Chunk.Model.GetTypeInfo(node..Type);

                fab.Add(FlatValue.String(Class.GetFullyQualifiedName()));

                {
                    FlatArrayBuilder varList = new FlatArrayBuilder();
                    varList.Add(FlatValue.String(node.Identifier.ToString()));
                    fab.Add(varList.GetFlatValue());
                }
                {
                    FlatArrayBuilder valueList = new FlatArrayBuilder();
                    if (node.EqualsValue != null)
                    {
                        if (node.EqualsValue.Value.Kind == SyntaxKind.NumericLiteralExpression)
                        {
                            valueList.Add(FlatValue.Int32(int.Parse(node.EqualsValue.Value.ToString())));
                        }
                        else
                        {
                            throw new NotImplementedException("Enum member without numeric literal expression");
                        }
                    }
                    else
                    {
                        throw new NotImplementedException("Enum member without numeric literal expression");
                    }

                    fab.Add(valueList.GetFlatValue());
                }

                Members.Add(fab.GetFlatValue());
            }
开发者ID:VendanAndrews,项目名称:ls2csc,代码行数:64,代码来源:TypeExtraInfo.cs

示例14: ZeroValuedEnumConstantSymbol

 public ZeroValuedEnumConstantSymbol(
     SourceMemberContainerTypeSymbol containingEnum,
     EnumMemberDeclarationSyntax syntax,
     DiagnosticBag diagnostics)
     : base(containingEnum, syntax, diagnostics)
 {
 }
开发者ID:riversky,项目名称:roslyn,代码行数:7,代码来源:SourceEnumConstantSymbol.cs

示例15: EnumMemberDeclaration

 /// <summary>
 /// Initializes a new instance of the <see cref="EnumMemberDeclaration"/> class.
 /// </summary>
 /// <param name="enumMemberDeclarationNode"></param>
 /// <param name="semanticModel"></param>
 public EnumMemberDeclaration(EnumMemberDeclarationSyntax enumMemberDeclarationNode, SemanticModel semanticModel)
     : base(enumMemberDeclarationNode, semanticModel)
 {
 }
开发者ID:andry-tino,项目名称:Rosetta,代码行数:9,代码来源:EnumMemberDeclaration.cs


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