diff options
author | jfrijters <jfrijters> | 2011-03-08 09:43:01 +0300 |
---|---|---|
committer | jfrijters <jfrijters> | 2011-03-08 09:43:01 +0300 |
commit | 602e60e74cf5bf23fe71a9cb710a853ba932de12 (patch) | |
tree | a6f20a6cc99c20e32a2c3c58f2a333c62c252555 /reflect/Reader | |
parent | 1c8b1c0cd5f334a21dbf936ebf6c8f3f9a7032aa (diff) |
Introduced base class for virtual Module classes to have common place to implement abstract Module methods that aren't supported.
Diffstat (limited to 'reflect/Reader')
-rw-r--r-- | reflect/Reader/GenericTypeParameter.cs | 67 | ||||
-rw-r--r-- | reflect/Reader/ResourceModule.cs | 56 |
2 files changed, 14 insertions, 109 deletions
diff --git a/reflect/Reader/GenericTypeParameter.cs b/reflect/Reader/GenericTypeParameter.cs index 43022aae..d99e1af8 100644 --- a/reflect/Reader/GenericTypeParameter.cs +++ b/reflect/Reader/GenericTypeParameter.cs @@ -94,13 +94,23 @@ namespace IKVM.Reflection.Reader private static readonly DummyModule module = new DummyModule(); private readonly int position; - private sealed class DummyModule : Module + private sealed class DummyModule : NonPEModule { internal DummyModule() : base(new Universe()) { } + protected override Exception NotSupportedException() + { + return new InvalidOperationException(); + } + + protected override Exception ArgumentOutOfRangeException() + { + return new InvalidOperationException(); + } + public override bool Equals(object obj) { throw new InvalidOperationException(); @@ -151,65 +161,10 @@ namespace IKVM.Reflection.Reader get { throw new InvalidOperationException(); } } - public override Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) - { - throw new InvalidOperationException(); - } - - public override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) - { - throw new InvalidOperationException(); - } - - public override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) - { - throw new InvalidOperationException(); - } - - public override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) - { - throw new InvalidOperationException(); - } - - public override string ResolveString(int metadataToken) - { - throw new InvalidOperationException(); - } - - public override Type[] __ResolveOptionalParameterTypes(int metadataToken) - { - throw new InvalidOperationException(); - } - public override string ScopeName { get { throw new InvalidOperationException(); } } - - public override AssemblyName[] __GetReferencedAssemblies() - { - throw new InvalidOperationException(); - } - - public override string[] __GetReferencedModules() - { - throw new InvalidOperationException(); - } - - internal override Type GetModuleType() - { - throw new InvalidOperationException(); - } - - internal override ByteReader GetBlob(int blobIndex) - { - throw new InvalidOperationException(); - } - - protected override long GetImageBaseImpl() - { - throw new InvalidOperationException(); - } } internal static Type Make(int position) diff --git a/reflect/Reader/ResourceModule.cs b/reflect/Reader/ResourceModule.cs index 717cdc27..cc41fecb 100644 --- a/reflect/Reader/ResourceModule.cs +++ b/reflect/Reader/ResourceModule.cs @@ -26,7 +26,7 @@ using System.Collections.Generic; namespace IKVM.Reflection.Reader { - sealed class ResourceModule : Module + sealed class ResourceModule : NonPEModule { private readonly Assembly assembly; private readonly string scopeName; @@ -75,51 +75,6 @@ namespace IKVM.Reflection.Reader get { throw new NotSupportedException(); } } - public override Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) - { - throw new NotSupportedException(); - } - - public override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) - { - throw new NotSupportedException(); - } - - public override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) - { - throw new NotSupportedException(); - } - - public override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) - { - throw new NotSupportedException(); - } - - public override string ResolveString(int metadataToken) - { - throw new NotSupportedException(); - } - - public override Type[] __ResolveOptionalParameterTypes(int metadataToken) - { - throw new NotSupportedException(); - } - - public override AssemblyName[] __GetReferencedAssemblies() - { - throw new NotSupportedException(); - } - - public override string[] __GetReferencedModules() - { - throw new NotSupportedException(); - } - - protected override long GetImageBaseImpl() - { - throw new NotSupportedException(); - } - internal override Type FindType(TypeName typeName) { return null; @@ -129,14 +84,9 @@ namespace IKVM.Reflection.Reader { } - internal override Type GetModuleType() - { - throw new InvalidOperationException(); - } - - internal override ByteReader GetBlob(int blobIndex) + protected override Exception ArgumentOutOfRangeException() { - throw new InvalidOperationException(); + return new NotSupportedException(); } } } |