Removed duplication of keeping track of AnnotationBuilder and moved enum nested type to AotTypeWrapper as well.

This commit is contained in:
jfrijters 2011-12-11 10:43:17 +00:00
Родитель b7530d8109
Коммит 387c7b17f6
2 изменённых файлов: 17 добавлений и 77 удалений

Просмотреть файл

@ -43,6 +43,7 @@ namespace IKVM.Internal
private MethodBuilder ghostCastArrayMethod; private MethodBuilder ghostCastArrayMethod;
private TypeBuilder typeBuilderGhostInterface; private TypeBuilder typeBuilderGhostInterface;
private Annotation annotation; private Annotation annotation;
private Type enumType;
private MethodWrapper[] replacedMethods; private MethodWrapper[] replacedMethods;
private WorkaroundBaseClass workaroundBaseClass; private WorkaroundBaseClass workaroundBaseClass;
@ -1174,6 +1175,19 @@ namespace IKVM.Internal
} }
} }
internal void SetEnumType(Type enumType)
{
this.enumType = enumType;
}
internal override Type EnumType
{
get
{
return enumType;
}
}
private sealed class ReplacedMethodWrapper : MethodWrapper private sealed class ReplacedMethodWrapper : MethodWrapper
{ {
private IKVM.Internal.MapXml.InstructionList code; private IKVM.Internal.MapXml.InstructionList code;

Просмотреть файл

@ -382,24 +382,6 @@ namespace IKVM.Internal
} }
} }
#if STATIC_COMPILER
internal override Annotation Annotation
{
get
{
return impl.Annotation;
}
}
internal override Type EnumType
{
get
{
return impl.EnumType;
}
}
#endif // STATIC_COMPILER
internal override void Finish() internal override void Finish()
{ {
// we don't need locking, because Finish is Thread safe // we don't need locking, because Finish is Thread safe
@ -442,10 +424,6 @@ namespace IKVM.Internal
internal abstract TypeWrapper[] InnerClasses { get; } internal abstract TypeWrapper[] InnerClasses { get; }
internal abstract TypeWrapper DeclaringTypeWrapper { get; } internal abstract TypeWrapper DeclaringTypeWrapper { get; }
internal abstract Modifiers ReflectiveModifiers { get; } internal abstract Modifiers ReflectiveModifiers { get; }
#if STATIC_COMPILER
internal abstract Annotation Annotation { get; }
internal abstract Type EnumType { get; }
#endif
internal abstract DynamicImpl Finish(); internal abstract DynamicImpl Finish();
internal abstract MethodBase LinkMethod(MethodWrapper mw); internal abstract MethodBase LinkMethod(MethodWrapper mw);
internal abstract FieldInfo LinkField(FieldWrapper fw); internal abstract FieldInfo LinkField(FieldWrapper fw);
@ -825,6 +803,7 @@ namespace IKVM.Internal
fieldBuilder.SetConstant(i); fieldBuilder.SetConstant(i);
} }
} }
((AotTypeWrapper)wrapper).SetEnumType(enumBuilder);
} }
TypeWrapper[] interfaces = wrapper.Interfaces; TypeWrapper[] interfaces = wrapper.Interfaces;
string[] implements = new string[interfaces.Length]; string[] implements = new string[interfaces.Length];
@ -1536,11 +1515,7 @@ namespace IKVM.Internal
finishedClinitMethod = type.GetMethod("__<clinit>", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); finishedClinitMethod = type.GetMethod("__<clinit>", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
} }
#endif #endif
finishedType = new FinishedTypeImpl(type, innerClassesTypeWrappers, declaringTypeWrapper, wrapper.ReflectiveModifiers, Metadata.Create(classFile), finishedClinitMethod, finalizeMethod finishedType = new FinishedTypeImpl(type, innerClassesTypeWrappers, declaringTypeWrapper, wrapper.ReflectiveModifiers, Metadata.Create(classFile), finishedClinitMethod, finalizeMethod);
#if STATIC_COMPILER
, annotationBuilder, enumBuilder
#endif
);
return finishedType; return finishedType;
} }
#if STATIC_COMPILER #if STATIC_COMPILER
@ -3134,24 +3109,6 @@ namespace IKVM.Internal
{ {
return finalizeMethod; return finalizeMethod;
} }
#if STATIC_COMPILER
internal override Annotation Annotation
{
get
{
return annotationBuilder;
}
}
internal override Type EnumType
{
get
{
return enumBuilder;
}
}
#endif // STATIC_COMPILER
} }
private sealed class Metadata private sealed class Metadata
@ -3374,17 +3331,8 @@ namespace IKVM.Internal
private MethodInfo clinitMethod; private MethodInfo clinitMethod;
private MethodInfo finalizeMethod; private MethodInfo finalizeMethod;
private Metadata metadata; private Metadata metadata;
#if STATIC_COMPILER
private Annotation annotationBuilder;
private TypeBuilder enumBuilder;
#endif
internal FinishedTypeImpl(Type type, TypeWrapper[] innerclasses, TypeWrapper declaringTypeWrapper, Modifiers reflectiveModifiers, Metadata metadata, MethodInfo clinitMethod, MethodInfo finalizeMethod internal FinishedTypeImpl(Type type, TypeWrapper[] innerclasses, TypeWrapper declaringTypeWrapper, Modifiers reflectiveModifiers, Metadata metadata, MethodInfo clinitMethod, MethodInfo finalizeMethod)
#if STATIC_COMPILER
, Annotation annotationBuilder
, TypeBuilder enumBuilder
#endif
)
{ {
this.type = type; this.type = type;
this.innerclasses = innerclasses; this.innerclasses = innerclasses;
@ -3393,10 +3341,6 @@ namespace IKVM.Internal
this.clinitMethod = clinitMethod; this.clinitMethod = clinitMethod;
this.finalizeMethod = finalizeMethod; this.finalizeMethod = finalizeMethod;
this.metadata = metadata; this.metadata = metadata;
#if STATIC_COMPILER
this.annotationBuilder = annotationBuilder;
this.enumBuilder = enumBuilder;
#endif
} }
internal override TypeWrapper[] InnerClasses internal override TypeWrapper[] InnerClasses
@ -3509,24 +3453,6 @@ namespace IKVM.Internal
{ {
return finalizeMethod; return finalizeMethod;
} }
#if STATIC_COMPILER
internal override Annotation Annotation
{
get
{
return annotationBuilder;
}
}
internal override Type EnumType
{
get
{
return enumBuilder;
}
}
#endif // STATIC_COMPILER
} }
internal sealed class FinishContext internal sealed class FinishContext