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

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJb Evain <jb@evain.net>2015-04-26 12:57:32 +0300
committerJb Evain <jb@evain.net>2015-05-08 18:38:22 +0300
commit50452a3c059e41038cd7cd0f0009d2efa10271f9 (patch)
tree8106b65986492f5c2902ec661f4fba7939a8db19
parent45194ee17738825db7801b15afb8391c30a28e95 (diff)
Share a common SignatureReader
-rw-r--r--Mono.Cecil/AssemblyReader.cs18
1 files changed, 9 insertions, 9 deletions
diff --git a/Mono.Cecil/AssemblyReader.cs b/Mono.Cecil/AssemblyReader.cs
index ee440cf..3a61ed0 100644
--- a/Mono.Cecil/AssemblyReader.cs
+++ b/Mono.Cecil/AssemblyReader.cs
@@ -366,6 +366,7 @@ namespace Mono.Cecil {
readonly internal MetadataSystem metadata;
internal IGenericContext context;
+ internal SignatureReader signature;
internal CodeReader code;
uint Position {
@@ -380,6 +381,7 @@ namespace Mono.Cecil {
this.module = module;
this.metadata = module.MetadataSystem;
this.code = new CodeReader (image.MetadataSection, this);
+ this.signature = new SignatureReader (this);
}
int GetCodedIndexSize (CodedIndex index)
@@ -1101,7 +1103,8 @@ namespace Mono.Cecil {
SignatureReader ReadSignature (uint signature)
{
- return new SignatureReader (signature, this);
+ this.signature.MoveToSignature (signature);
+ return this.signature;
}
public bool HasInterfaces (TypeDefinition type)
@@ -2687,26 +2690,23 @@ namespace Mono.Cecil {
sealed class SignatureReader : ByteBuffer {
readonly MetadataReader reader;
- readonly uint start, sig_length;
+ uint start, sig_length;
TypeSystem TypeSystem {
get { return reader.module.TypeSystem; }
}
- public SignatureReader (uint blob, MetadataReader reader)
+ public SignatureReader (MetadataReader reader)
: base (reader.buffer)
{
this.reader = reader;
-
- MoveToBlob (blob);
-
- this.sig_length = ReadCompressedUInt32 ();
- this.start = (uint) position;
}
- void MoveToBlob (uint blob)
+ public void MoveToSignature (uint blob)
{
position = (int) (reader.image.BlobHeap.Offset + blob);
+ this.sig_length = ReadCompressedUInt32();
+ this.start = (uint) position;
}
MetadataToken ReadTypeTokenSignature ()