本文整理汇总了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);
}
示例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 };
}
示例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));
}
}
示例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;
}
}
}
示例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;
}
}
示例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);
}
}
}
示例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);
}
}
示例8: OnEnumDefinition
public override void OnEnumDefinition(EnumDefinition node)
{
base.OnEnumDefinition(node);
_emitter.EmitTypeAttributes(node);
}
示例9: LeaveEnumDefinition
public override void LeaveEnumDefinition(EnumDefinition node)
{
LeaveTypeDefinition(node);
}
示例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);
}
}
示例11: InternalEnum
internal InternalEnum(TypeSystemServices tagManager, EnumDefinition enumDefinition)
: base(tagManager, enumDefinition)
{
}
示例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;
}
}
}
示例13: OnEnumDefinition
public override void OnEnumDefinition(EnumDefinition node)
{
}
示例14: LeaveEnumDefinition
public override void LeaveEnumDefinition(EnumDefinition node)
{
CantBeMarkedAbstract(node);
CantBeMarkedPartialIfNested(node);
CantBeMarkedFinal(node);
CantBeMarkedStatic(node);
}
示例15: GetEnumUnderlyingType
private Type GetEnumUnderlyingType(EnumDefinition node)
{
return ((InternalEnum) node.Entity).UnderlyingType;
}