internal override Type GetTypeBuilderOrEnumBuilder(){
if (this.classob.classwriter != null) return this.classob.classwriter;
this.PartiallyEvaluate();
ClassScope classScope = this.enclosingScope as ClassScope;
if (classScope != null){
TypeBuilder result = ((TypeBuilder)classScope.classwriter).DefineNestedType(this.name, this.attributes|TypeAttributes.Sealed, Typeob.Enum, null);
this.classob.classwriter = result;
Type underlyingType = this.baseType.ToType();
FieldBuilder fb = result.DefineField("value__", underlyingType, FieldAttributes.Private|FieldAttributes.SpecialName);
if (this.customAttributes != null){
CustomAttributeBuilder[] custAtt = this.customAttributes.GetCustomAttributeBuilders(false);
for (int j = 0; j < custAtt.Length; j++)
result.SetCustomAttribute(custAtt[j]);
}
foreach (FieldInfo field in this.fields){
((JSMemberField)field).metaData = fb = result.DefineField(field.Name, result, FieldAttributes.Public|FieldAttributes.Static|FieldAttributes.Literal);
fb.SetConstant(((EnumWrapper)field.GetValue(null)).ToNumericValue());
}
return result;
}else{
EnumBuilder result = compilerGlobals.module.DefineEnum(this.name, this.attributes, this.baseType.ToType());
this.classob.classwriter = result;
if (this.customAttributes != null){
CustomAttributeBuilder[] custAtt = this.customAttributes.GetCustomAttributeBuilders(false);
for (int j = 0; j < custAtt.Length; j++)
result.SetCustomAttribute(custAtt[j]);
}
foreach (FieldInfo field in this.fields)
((JSMemberField)field).metaData = result.DefineLiteral(field.Name, ((EnumWrapper)field.GetValue(null)).ToNumericValue());
return result;
}
}
}