Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2013-07-30 22:04:59 +0400
committerjfrijters <jfrijters>2013-07-30 22:04:59 +0400
commit543148ee71028a5558c230094e0be9953c64ef4f (patch)
treeaac25973a0b28692aa2fd1221ae7fd803dbf15e2
parent5cf1352451813326e4e17927767a966b07f03ffc (diff)
Moved CLI enum creation to separate method.
-rw-r--r--runtime/DynamicTypeWrapper.cs43
1 files changed, 25 insertions, 18 deletions
diff --git a/runtime/DynamicTypeWrapper.cs b/runtime/DynamicTypeWrapper.cs
index 12fb2111..8abba386 100644
--- a/runtime/DynamicTypeWrapper.cs
+++ b/runtime/DynamicTypeWrapper.cs
@@ -817,24 +817,7 @@ namespace IKVM.Internal
// This is primarily to support annotations that take enum parameters.
if (f.IsEnum && f.IsPublic)
{
- CompilerClassLoader ccl = wrapper.classLoader;
- string name = "__Enum";
- while (!ccl.ReserveName(f.Name + "$" + name))
- {
- name += "_";
- }
- enumBuilder = typeBuilder.DefineNestedType(name, TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.NestedPublic | TypeAttributes.Serializable, Types.Enum);
- AttributeHelper.HideFromJava(enumBuilder);
- enumBuilder.DefineField("value__", Types.Int32, FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
- for (int i = 0; i < f.Fields.Length; i++)
- {
- if (f.Fields[i].IsEnum)
- {
- FieldBuilder fieldBuilder = enumBuilder.DefineField(f.Fields[i].Name, enumBuilder, FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
- fieldBuilder.SetConstant(i);
- }
- }
- wrapper.SetEnumType(enumBuilder);
+ AddCliEnum();
}
TypeWrapper[] interfaces = wrapper.Interfaces;
string[] implements = new string[interfaces.Length];
@@ -913,6 +896,30 @@ namespace IKVM.Internal
#endif
}
+#if STATIC_COMPILER
+ private void AddCliEnum()
+ {
+ CompilerClassLoader ccl = wrapper.classLoader;
+ string name = "__Enum";
+ while (!ccl.ReserveName(classFile.Name + "$" + name))
+ {
+ name += "_";
+ }
+ enumBuilder = typeBuilder.DefineNestedType(name, TypeAttributes.Class | TypeAttributes.Sealed | TypeAttributes.NestedPublic | TypeAttributes.Serializable, Types.Enum);
+ AttributeHelper.HideFromJava(enumBuilder);
+ enumBuilder.DefineField("value__", Types.Int32, FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
+ for (int i = 0; i < classFile.Fields.Length; i++)
+ {
+ if (classFile.Fields[i].IsEnum)
+ {
+ FieldBuilder fieldBuilder = enumBuilder.DefineField(classFile.Fields[i].Name, enumBuilder, FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
+ fieldBuilder.SetConstant(i);
+ }
+ }
+ wrapper.SetEnumType(enumBuilder);
+ }
+#endif
+
private void AddClinitTrigger()
{
// We create a empty method that we can use to trigger our .cctor