diff options
author | jbevain <jbevain@gmail.com> | 2011-08-26 10:58:58 +0400 |
---|---|---|
committer | jbevain <jbevain@gmail.com> | 2011-08-26 10:58:58 +0400 |
commit | 5ce1cb68f1ce811ee530e18220fdf934b58d052c (patch) | |
tree | 238e10cb9622f386d6ec8e80dbee985edb07dd9d /Mono.Cecil | |
parent | 611c4aaa58c6ff0aeebde550fc7d41939c396b99 (diff) |
Unbound generic parameters still need to be related to a module
Diffstat (limited to 'Mono.Cecil')
-rw-r--r-- | Mono.Cecil/AssemblyReader.cs | 4 | ||||
-rw-r--r-- | Mono.Cecil/GenericParameter.cs | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/Mono.Cecil/AssemblyReader.cs b/Mono.Cecil/AssemblyReader.cs index cef3ca8..72cb480 100644 --- a/Mono.Cecil/AssemblyReader.cs +++ b/Mono.Cecil/AssemblyReader.cs @@ -2674,9 +2674,9 @@ namespace Mono.Cecil { return provider.GenericParameters [index]; } - static GenericParameter GetUnboundGenericParameter (GenericParameterType type, int index) + GenericParameter GetUnboundGenericParameter (GenericParameterType type, int index) { - return new GenericParameter (index, type); + return new GenericParameter (index, type, reader.module); } static void CheckGenericContext (IGenericParameterProvider owner, int index) diff --git a/Mono.Cecil/GenericParameter.cs b/Mono.Cecil/GenericParameter.cs index 664f00a..d694e29 100644 --- a/Mono.Cecil/GenericParameter.cs +++ b/Mono.Cecil/GenericParameter.cs @@ -110,7 +110,7 @@ namespace Mono.Cecil { } public override ModuleDefinition Module { - get { return owner != null ? owner.Module : null; } + get { return module ?? owner.Module; } } public override string Name { @@ -194,12 +194,16 @@ namespace Mono.Cecil { this.etype = ConvertGenericParameterType (this.type); } - public GenericParameter (int position, GenericParameterType type) + public GenericParameter (int position, GenericParameterType type, ModuleDefinition module) : base (string.Empty, string.Empty) { + if (module == null) + throw new ArgumentNullException (); + this.position = position; this.type = type; this.etype = ConvertGenericParameterType (type); + this.module = module; } static ElementType ConvertGenericParameterType (GenericParameterType type) |