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


C# Ast.EnumDefinition类代码示例

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


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

示例1: OnEnumDefinition

 public override void OnEnumDefinition(EnumDefinition node)
 {
     if (null != node.Entity)
     {
         return;
     }
     node.Entity = new InternalEnum(TypeSystemServices, node);
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:8,代码来源:BindTypeDefinitions.cs

示例2: LeaveEnumDefinition

		override public void LeaveEnumDefinition(EnumDefinition node)
		{
			_members.Clear();
			foreach (TypeMember member in node.Members)
				if (_members.ContainsKey(member.Name))
					MemberNameConflict(member);
				else
					_members[member.Name] = new List<TypeMember>() { member };
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:9,代码来源:CheckMemberNames.cs

示例3: LeaveEnumDefinition

        public override void LeaveEnumDefinition(EnumDefinition node)
        {
            CheckName(node,node.Name);

            foreach (EnumMember member in node.Members)
            {
                if (member.Initializer.NodeType != NodeType.IntegerLiteralExpression)
                    Errors.Add(
                        CompilerErrorFactory.EnumMemberMustBeConstant(member));
            }
        }
开发者ID:neonux,项目名称:boo,代码行数:11,代码来源:CheckIdentifiers.cs

示例4: LeaveEnumDefinition

 public override void LeaveEnumDefinition(EnumDefinition node)
 {
     _members.Clear();
     foreach (TypeMember member in node.Members)
     {
         if (_members.ContainsKey(member.Name))
         {
             MemberNameConflict(member);
         }
         else
         {
             _members[member.Name] = member;
         }
     }
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:15,代码来源:CheckMemberNames.cs

示例5: OnEnumDefinition

		override public void OnEnumDefinition(EnumDefinition node)
		{
			long lastValue = 0;
			foreach (EnumMember member in node.Members)
			{
				if (null == member.Initializer)
				{
					member.Initializer = new IntegerLiteralExpression(lastValue);
				}
				else if (member.Initializer.NodeType == NodeType.IntegerLiteralExpression)
				{
					lastValue = ((IntegerLiteralExpression) member.Initializer).Value;
				}
				++lastValue;
			}
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:16,代码来源:BindEnumMembers.cs

示例6: OnEnumDefinition

        public override void OnEnumDefinition(EnumDefinition node)
        {
            long lastValue = 0;
            foreach (EnumMember member in node.Members)
            {
                if (null == member.Initializer)
                {
                    member.Initializer = new IntegerLiteralExpression(lastValue);
                }
                lastValue = member.Initializer.Value + 1;

                if (null == member.Entity)
                {
                    member.Entity = new InternalEnumMember(TypeSystemServices, member);
                }
            }
        }
开发者ID:boo,项目名称:boo-lang,代码行数:17,代码来源:BindEnumMembers.cs

示例7: EmitTypeAttributes

 void EmitTypeAttributes(EnumDefinition node)
 {
     EnumBuilder builder = GetBuilder(node) as EnumBuilder;
     if (null != builder)
     {
         EmitAttributes(node, builder.SetCustomAttribute);
     }
     else //nested enum
     {
         TypeBuilder typeBuilder = GetTypeBuilder(node);
         EmitAttributes(node, typeBuilder.SetCustomAttribute);
     }
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:13,代码来源:EmitAssembly.cs

示例8: OnEnumDefinition

 public override void OnEnumDefinition(EnumDefinition node)
 {
     base.OnEnumDefinition(node);
     _emitter.EmitTypeAttributes(node);
 }
开发者ID:skalinets,项目名称:boo,代码行数:5,代码来源:EmitAssembly.cs

示例9: LeaveEnumDefinition

 public override void LeaveEnumDefinition(EnumDefinition node)
 {
     LeaveTypeDefinition(node);
 }
开发者ID:elfrostie,项目名称:boo,代码行数:4,代码来源:NormalizeTypeAndMemberDefinitions.cs

示例10: OnEnumDefinition

 public override void OnEnumDefinition(EnumDefinition node)
 {
     TypeBuilder builder = GetTypeBuilder(node);
     foreach (EnumMember member in node.Members)
     {
         FieldBuilder field = builder.DefineField(member.Name, builder,
                                                  FieldAttributes.Public |
                                                  FieldAttributes.Static |
                                                  FieldAttributes.Literal);
         field.SetConstant((int)member.Initializer.Value);
         SetBuilder(member, field);
     }
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:13,代码来源:EmitAssembly.cs

示例11: InternalEnum

 internal InternalEnum(TypeSystemServices tagManager, EnumDefinition enumDefinition)
     : base(tagManager, enumDefinition)
 {
 }
开发者ID:boo,项目名称:boo-lang,代码行数:4,代码来源:InternalEnum.cs

示例12: enum_member

        //throws RecognitionException, TokenStreamException
        protected void enum_member(
            EnumDefinition container
            )
        {
            IToken  id = null;

                EnumMember em = null;
                Expression initializer = null;

            try {      // for error handling
            attributes();
            id = LT(1);
            match(ID);
            {
                switch ( LA(1) )
                {
                case ASSIGN:
                {
                    match(ASSIGN);
                    initializer=simple_initializer();
                    break;
                }
                case EOL:
                case EOS:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            if (0==inputState.guessing)
            {

                        em = new EnumMember(ToLexicalInfo(id));
                        em.Name = id.getText();
                        em.Initializer = initializer;
                        AddAttributes(em.Attributes);
                        container.Members.Add(em);

            }
            eos();
            docstring(em);
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_38_);
            }
            else
            {
                throw ex;
            }
            }
        }
开发者ID:elfrostie,项目名称:boo,代码行数:60,代码来源:BooParserBase.cs

示例13: OnEnumDefinition

 public override void OnEnumDefinition(EnumDefinition node)
 {
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:3,代码来源:BindBaseTypes.cs

示例14: LeaveEnumDefinition

 public override void LeaveEnumDefinition(EnumDefinition node)
 {
     CantBeMarkedAbstract(node);
     CantBeMarkedPartialIfNested(node);
     CantBeMarkedFinal(node);
     CantBeMarkedStatic(node);
 }
开发者ID:scottstephens,项目名称:boo,代码行数:7,代码来源:PreErrorChecking.cs

示例15: GetEnumUnderlyingType

 private Type GetEnumUnderlyingType(EnumDefinition node)
 {
     return ((InternalEnum) node.Entity).UnderlyingType;
 }
开发者ID:Bombadil77,项目名称:boo,代码行数:4,代码来源:EmitAssembly.cs


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