From 37de037718fb623e0bfbb5384a8a5e4717081e63 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Mon, 25 Apr 2011 15:28:02 +0200 Subject: [PATCH] Update to latest Cecil (4bc52d2976f7060dc65fb4075f301e4f9daaeb93 + thread-safe fixes) --- Mono.Cecil/.gitignore | 1 + Mono.Cecil/Mono.Cecil.Cil/Code.cs | 2 +- Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs | 10 +- Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs | 4 +- Mono.Cecil/Mono.Cecil.Cil/Document.cs | 2 +- Mono.Cecil/Mono.Cecil.Cil/ExceptionHandler.cs | 8 +- Mono.Cecil/Mono.Cecil.Cil/ILProcessor.cs | 2 +- Mono.Cecil/Mono.Cecil.Cil/Instruction.cs | 2 +- Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs | 2 +- Mono.Cecil/Mono.Cecil.Cil/OpCode.cs | 549 ++++++++---------- Mono.Cecil/Mono.Cecil.Cil/OpCodes.cs | 2 +- Mono.Cecil/Mono.Cecil.Cil/SequencePoint.cs | 2 +- Mono.Cecil/Mono.Cecil.Cil/Symbols.cs | 9 +- .../Mono.Cecil.Cil/VariableDefinition.cs | 2 +- .../Mono.Cecil.Cil/VariableReference.cs | 2 +- Mono.Cecil/Mono.Cecil.Metadata/BlobHeap.cs | 2 +- Mono.Cecil/Mono.Cecil.Metadata/Buffers.cs | 4 +- Mono.Cecil/Mono.Cecil.Metadata/CodedIndex.cs | 2 +- Mono.Cecil/Mono.Cecil.Metadata/ElementType.cs | 2 +- Mono.Cecil/Mono.Cecil.Metadata/GuidHeap.cs | 2 +- Mono.Cecil/Mono.Cecil.Metadata/Heap.cs | 2 +- .../Mono.Cecil.Metadata/MetadataToken.cs | 2 +- Mono.Cecil/Mono.Cecil.Metadata/Row.cs | 2 +- Mono.Cecil/Mono.Cecil.Metadata/StringHeap.cs | 2 +- Mono.Cecil/Mono.Cecil.Metadata/TableHeap.cs | 52 +- Mono.Cecil/Mono.Cecil.Metadata/TokenType.cs | 2 +- .../Mono.Cecil.Metadata/UserStringHeap.cs | 2 +- Mono.Cecil/Mono.Cecil.Metadata/Utilities.cs | 2 +- .../Mono.Cecil.PE/BinaryStreamReader.cs | 2 +- .../Mono.Cecil.PE/BinaryStreamWriter.cs | 2 +- Mono.Cecil/Mono.Cecil.PE/ByteBuffer.cs | 2 +- .../ByteBufferEqualityComparer.cs | 2 +- Mono.Cecil/Mono.Cecil.PE/DataDirectory.cs | 2 +- Mono.Cecil/Mono.Cecil.PE/Image.cs | 2 +- Mono.Cecil/Mono.Cecil.PE/ImageReader.cs | 25 +- Mono.Cecil/Mono.Cecil.PE/ImageWriter.cs | 2 +- Mono.Cecil/Mono.Cecil.PE/Section.cs | 2 +- Mono.Cecil/Mono.Cecil.PE/TextMap.cs | 2 +- Mono.Cecil/Mono.Cecil.nuspec | 23 + Mono.Cecil/Mono.Cecil/ArrayType.cs | 2 +- Mono.Cecil/Mono.Cecil/AssemblyDefinition.cs | 4 +- Mono.Cecil/Mono.Cecil/AssemblyFlags.cs | 2 +- .../Mono.Cecil/AssemblyHashAlgorithm.cs | 2 +- Mono.Cecil/Mono.Cecil/AssemblyInfo.cs | 2 +- .../Mono.Cecil/AssemblyLinkedResource.cs | 2 +- .../Mono.Cecil/AssemblyNameDefinition.cs | 2 +- .../Mono.Cecil/AssemblyNameReference.cs | 2 +- Mono.Cecil/Mono.Cecil/AssemblyReader.cs | 164 ++++-- Mono.Cecil/Mono.Cecil/AssemblyWriter.cs | 67 ++- Mono.Cecil/Mono.Cecil/BaseAssemblyResolver.cs | 19 +- Mono.Cecil/Mono.Cecil/CallSite.cs | 84 ++- Mono.Cecil/Mono.Cecil/CustomAttribute.cs | 2 +- .../Mono.Cecil/DefaultAssemblyResolver.cs | 2 +- Mono.Cecil/Mono.Cecil/EmbeddedResource.cs | 2 +- Mono.Cecil/Mono.Cecil/EventAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/EventDefinition.cs | 2 +- Mono.Cecil/Mono.Cecil/EventReference.cs | 2 +- Mono.Cecil/Mono.Cecil/ExportedType.cs | 2 +- Mono.Cecil/Mono.Cecil/FieldAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/FieldDefinition.cs | 2 +- Mono.Cecil/Mono.Cecil/FieldReference.cs | 2 +- Mono.Cecil/Mono.Cecil/FileAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/FunctionPointerType.cs | 2 +- .../Mono.Cecil/GenericInstanceMethod.cs | 9 +- Mono.Cecil/Mono.Cecil/GenericInstanceType.cs | 9 +- Mono.Cecil/Mono.Cecil/GenericParameter.cs | 6 +- .../Mono.Cecil/GenericParameterAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/IConstantProvider.cs | 2 +- .../Mono.Cecil/ICustomAttributeProvider.cs | 2 +- Mono.Cecil/Mono.Cecil/IGenericInstance.cs | 2 +- .../Mono.Cecil/IGenericParameterProvider.cs | 2 +- Mono.Cecil/Mono.Cecil/IMarshalInfoProvider.cs | 2 +- Mono.Cecil/Mono.Cecil/IMemberDefinition.cs | 2 +- Mono.Cecil/Mono.Cecil/IMetadataScope.cs | 2 +- .../Mono.Cecil/IMetadataTokenProvider.cs | 2 +- Mono.Cecil/Mono.Cecil/IMethodSignature.cs | 2 +- Mono.Cecil/Mono.Cecil/Import.cs | 2 +- Mono.Cecil/Mono.Cecil/LinkedResource.cs | 2 +- .../Mono.Cecil/ManifestResourceAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/MarshalInfo.cs | 2 +- .../Mono.Cecil/MemberDefinitionCollection.cs | 2 +- Mono.Cecil/Mono.Cecil/MemberReference.cs | 2 +- Mono.Cecil/Mono.Cecil/MetadataResolver.cs | 27 +- Mono.Cecil/Mono.Cecil/MetadataSystem.cs | 2 +- Mono.Cecil/Mono.Cecil/MethodAttributes.cs | 2 +- .../Mono.Cecil/MethodCallingConvention.cs | 2 +- Mono.Cecil/Mono.Cecil/MethodDefinition.cs | 2 +- Mono.Cecil/Mono.Cecil/MethodImplAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/MethodReference.cs | 2 +- Mono.Cecil/Mono.Cecil/MethodReturnType.cs | 2 +- .../Mono.Cecil/MethodSemanticsAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/MethodSpecification.cs | 2 +- Mono.Cecil/Mono.Cecil/Modifiers.cs | 2 +- Mono.Cecil/Mono.Cecil/ModuleDefinition.cs | 13 +- Mono.Cecil/Mono.Cecil/ModuleKind.cs | 2 +- Mono.Cecil/Mono.Cecil/ModuleReference.cs | 2 +- Mono.Cecil/Mono.Cecil/NativeType.cs | 2 +- Mono.Cecil/Mono.Cecil/PInvokeAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/PInvokeInfo.cs | 2 +- Mono.Cecil/Mono.Cecil/ParameterAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/ParameterDefinition.cs | 2 +- .../ParameterDefinitionCollection.cs | 2 +- Mono.Cecil/Mono.Cecil/ParameterReference.cs | 2 +- Mono.Cecil/Mono.Cecil/PinnedType.cs | 2 +- Mono.Cecil/Mono.Cecil/PointerType.cs | 2 +- Mono.Cecil/Mono.Cecil/PropertyAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/PropertyDefinition.cs | 4 +- Mono.Cecil/Mono.Cecil/PropertyReference.cs | 2 +- Mono.Cecil/Mono.Cecil/ReferenceType.cs | 2 +- Mono.Cecil/Mono.Cecil/Resource.cs | 2 +- Mono.Cecil/Mono.Cecil/SecurityDeclaration.cs | 4 +- Mono.Cecil/Mono.Cecil/SentinelType.cs | 2 +- Mono.Cecil/Mono.Cecil/TargetRuntime.cs | 2 +- Mono.Cecil/Mono.Cecil/TypeAttributes.cs | 2 +- Mono.Cecil/Mono.Cecil/TypeDefinition.cs | 6 +- .../Mono.Cecil/TypeDefinitionCollection.cs | 2 +- Mono.Cecil/Mono.Cecil/TypeParser.cs | 2 +- Mono.Cecil/Mono.Cecil/TypeReference.cs | 2 +- Mono.Cecil/Mono.Cecil/TypeSpecification.cs | 2 +- Mono.Cecil/Mono.Cecil/TypeSystem.cs | 6 +- Mono.Cecil/Mono.Cecil/VariantType.cs | 2 +- .../Mono.Collections.Generic/Collection.cs | 5 +- .../ReadOnlyCollection.cs | 19 +- .../CryptoService.cs | 2 +- Mono.Cecil/Mono/Actions.cs | 4 +- Mono.Cecil/Mono/Empty.cs | 2 +- Mono.Cecil/Mono/Funcs.cs | 2 +- .../ExtensionAttribute.cs | 2 +- .../SecurityDeclarationTests.cs | 37 ++ .../Test/Resources/assemblies/decsec1-xml.dll | Bin 0 -> 4096 bytes .../rocks/Mono.Cecil.Rocks/AssemblyInfo.cs | 2 +- .../rocks/Mono.Cecil.Rocks/Functional.cs | 2 +- Mono.Cecil/rocks/Mono.Cecil.Rocks/ILParser.cs | 4 +- .../rocks/Mono.Cecil.Rocks/MethodBodyRocks.cs | 2 +- .../Mono.Cecil.Rocks/MethodDefinitionRocks.cs | 2 +- .../Mono.Cecil.Rocks/ModuleDefinitionRocks.cs | 2 +- .../SecurityDeclarationRocks.cs | 2 +- .../Mono.Cecil.Rocks/TypeDefinitionRocks.cs | 2 +- .../Mono.Cecil.Rocks/TypeReferenceRocks.cs | 2 +- .../mdb/Mono.Cecil.Mdb/AssemblyInfo.cs | 2 +- .../symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs | 2 +- .../symbols/mdb/Mono.Cecil.Mdb/MdbWriter.cs | 2 +- .../pdb/Mono.Cecil.Pdb/AssemblyInfo.cs | 2 +- .../symbols/pdb/Mono.Cecil.Pdb/PdbHelper.cs | 2 +- .../symbols/pdb/Mono.Cecil.Pdb/PdbReader.cs | 2 +- .../symbols/pdb/Mono.Cecil.Pdb/PdbWriter.cs | 2 +- 146 files changed, 786 insertions(+), 622 deletions(-) create mode 100644 Mono.Cecil/Mono.Cecil.nuspec create mode 100644 Mono.Cecil/Test/Resources/assemblies/decsec1-xml.dll diff --git a/Mono.Cecil/.gitignore b/Mono.Cecil/.gitignore index 3629e370c..e6204e104 100644 --- a/Mono.Cecil/.gitignore +++ b/Mono.Cecil/.gitignore @@ -5,3 +5,4 @@ obj *.pidb *.userprefs *.xml +*.nupkg diff --git a/Mono.Cecil/Mono.Cecil.Cil/Code.cs b/Mono.Cecil/Mono.Cecil.Cil/Code.cs index bd18b842a..fa88b63d6 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/Code.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/Code.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs b/Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs index 4cfc7db75..61d04d95b 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -49,18 +49,13 @@ namespace Mono.Cecil.Cil { get { return base.position - start; } } - CodeReader (Section section, MetadataReader reader) + public CodeReader (Section section, MetadataReader reader) : base (section.Data) { this.code_section = section; this.reader = reader; } - public static CodeReader CreateCodeReader (MetadataReader metadata) - { - return new CodeReader (metadata.image.MetadataSection, metadata); - } - public MethodBody ReadMethodBody (MethodDefinition method) { this.method = method; @@ -364,7 +359,6 @@ namespace Mono.Cecil.Cil { break; case ExceptionHandlerType.Filter: handler.FilterStart = GetInstruction (ReadInt32 ()); - handler.FilterEnd = handler.HandlerStart.Previous; break; default: Advance (4); diff --git a/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs b/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs index 8bf072241..241203438 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -510,7 +510,7 @@ namespace Mono.Cecil.Cil { return true; if (handler.HandlerType == ExceptionHandlerType.Filter - && IsFatRange (handler.FilterStart, handler.FilterEnd)) + && IsFatRange (handler.FilterStart, handler.HandlerStart)) return true; } diff --git a/Mono.Cecil/Mono.Cecil.Cil/Document.cs b/Mono.Cecil/Mono.Cecil.Cil/Document.cs index e46d2c1d8..6648b7aac 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/Document.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/Document.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandler.cs b/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandler.cs index a76f8f397..c61ff235e 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandler.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandler.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -40,7 +40,6 @@ namespace Mono.Cecil.Cil { Instruction try_start; Instruction try_end; Instruction filter_start; - Instruction filter_end; Instruction handler_start; Instruction handler_end; @@ -62,11 +61,6 @@ namespace Mono.Cecil.Cil { set { filter_start = value; } } - public Instruction FilterEnd { - get { return filter_end; } - set { filter_end = value; } - } - public Instruction HandlerStart { get { return handler_start; } set { handler_start = value; } diff --git a/Mono.Cecil/Mono.Cecil.Cil/ILProcessor.cs b/Mono.Cecil/Mono.Cecil.Cil/ILProcessor.cs index 1300b3e6b..cd5dbb40f 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/ILProcessor.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/ILProcessor.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Cil/Instruction.cs b/Mono.Cecil/Mono.Cecil.Cil/Instruction.cs index e8d36c4b3..c28d4c992 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/Instruction.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/Instruction.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs b/Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs index b57900e5a..4ae749b93 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Cil/OpCode.cs b/Mono.Cecil/Mono.Cecil.Cil/OpCode.cs index aad4ba4b9..1a1442130 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/OpCode.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/OpCode.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -116,7 +116,7 @@ namespace Mono.Cecil.Cil { readonly byte stack_behavior_push; public string Name { - get { return OpCodeNames.names [op1 == 0xff ? op2 : op2 + 256]; } + get { return OpCodeNames.names [(int) Code]; } } public int Size { @@ -132,7 +132,7 @@ namespace Mono.Cecil.Cil { } public short Value { - get { return (short) ((op1 << 8) | op2); } + get { return op1 == 0xff ? op2 : (short) ((op1 << 8) | op2); } } public Code Code { @@ -214,311 +214,242 @@ namespace Mono.Cecil.Cil { static class OpCodeNames { - internal static readonly string [] names = { - "nop", - "break", - "ldarg.0", - "ldarg.1", - "ldarg.2", - "ldarg.3", - "ldloc.0", - "ldloc.1", - "ldloc.2", - "ldloc.3", - "stloc.0", - "stloc.1", - "stloc.2", - "stloc.3", - "ldarg.s", - "ldarga.s", - "starg.s", - "ldloc.s", - "ldloca.s", - "stloc.s", - "ldnull", - "ldc.i4.m1", - "ldc.i4.0", - "ldc.i4.1", - "ldc.i4.2", - "ldc.i4.3", - "ldc.i4.4", - "ldc.i4.5", - "ldc.i4.6", - "ldc.i4.7", - "ldc.i4.8", - "ldc.i4.s", - "ldc.i4", - "ldc.i8", - "ldc.r4", - "ldc.r8", - null, - "dup", - "pop", - "jmp", - "call", - "calli", - "ret", - "br.s", - "brfalse.s", - "brtrue.s", - "beq.s", - "bge.s", - "bgt.s", - "ble.s", - "blt.s", - "bne.un.s", - "bge.un.s", - "bgt.un.s", - "ble.un.s", - "blt.un.s", - "br", - "brfalse", - "brtrue", - "beq", - "bge", - "bgt", - "ble", - "blt", - "bne.un", - "bge.un", - "bgt.un", - "ble.un", - "blt.un", - "switch", - "ldind.i1", - "ldind.u1", - "ldind.i2", - "ldind.u2", - "ldind.i4", - "ldind.u4", - "ldind.i8", - "ldind.i", - "ldind.r4", - "ldind.r8", - "ldind.ref", - "stind.ref", - "stind.i1", - "stind.i2", - "stind.i4", - "stind.i8", - "stind.r4", - "stind.r8", - "add", - "sub", - "mul", - "div", - "div.un", - "rem", - "rem.un", - "and", - "or", - "xor", - "shl", - "shr", - "shr.un", - "neg", - "not", - "conv.i1", - "conv.i2", - "conv.i4", - "conv.i8", - "conv.r4", - "conv.r8", - "conv.u4", - "conv.u8", - "callvirt", - "cpobj", - "ldobj", - "ldstr", - "newobj", - "castclass", - "isinst", - "conv.r.un", - null, - null, - "unbox", - "throw", - "ldfld", - "ldflda", - "stfld", - "ldsfld", - "ldsflda", - "stsfld", - "stobj", - "conv.ovf.i1.un", - "conv.ovf.i2.un", - "conv.ovf.i4.un", - "conv.ovf.i8.un", - "conv.ovf.u1.un", - "conv.ovf.u2.un", - "conv.ovf.u4.un", - "conv.ovf.u8.un", - "conv.ovf.i.un", - "conv.ovf.u.un", - "box", - "newarr", - "ldlen", - "ldelema", - "ldelem.i1", - "ldelem.u1", - "ldelem.i2", - "ldelem.u2", - "ldelem.i4", - "ldelem.u4", - "ldelem.i8", - "ldelem.i", - "ldelem.r4", - "ldelem.r8", - "ldelem.ref", - "stelem.i", - "stelem.i1", - "stelem.i2", - "stelem.i4", - "stelem.i8", - "stelem.r4", - "stelem.r8", - "stelem.ref", - "ldelem.any", - "stelem.any", - "unbox.any", - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - "conv.ovf.i1", - "conv.ovf.u1", - "conv.ovf.i2", - "conv.ovf.u2", - "conv.ovf.i4", - "conv.ovf.u4", - "conv.ovf.i8", - "conv.ovf.u8", - null, - null, - null, - null, - null, - null, - null, - "refanyval", - "ckfinite", - null, - null, - "mkrefany", - null, - null, - null, - null, - null, - null, - null, - null, - null, - "ldtoken", - "conv.u2", - "conv.u1", - "conv.i", - "conv.ovf.i", - "conv.ovf.u", - "add.ovf", - "add.ovf.un", - "mul.ovf", - "mul.ovf.un", - "sub.ovf", - "sub.ovf.un", - "endfinally", - "leave", - "leave.s", - "stind.i", - "conv.u", - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - "prefix7", - "prefix6", - "prefix5", - "prefix4", - "prefix3", - "prefix2", - "prefix1", - "prefixref", - "arglist", - "ceq", - "cgt", - "cgt.un", - "clt", - "clt.un", - "ldftn", - "ldvirtftn", - null, - "ldarg", - "ldarga", - "starg", - "ldloc", - "ldloca", - "stloc", - "localloc", - null, - "endfilter", - "unaligned.", - "volatile.", - "tail.", - "initobj", - "constrained.", - "cpblk", - "initblk", - "no.", // added by spouliot to match Cecil existing definitions - "rethrow", - null, - "sizeof", - "refanytype", - "readonly.", // added by spouliot to match Cecil existing definitions - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - }; + internal static readonly string [] names; + + static OpCodeNames () + { + var table = new byte [] { + 3, 110, 111, 112, + 5, 98, 114, 101, 97, 107, + 7, 108, 100, 97, 114, 103, 46, 48, + 7, 108, 100, 97, 114, 103, 46, 49, + 7, 108, 100, 97, 114, 103, 46, 50, + 7, 108, 100, 97, 114, 103, 46, 51, + 7, 108, 100, 108, 111, 99, 46, 48, + 7, 108, 100, 108, 111, 99, 46, 49, + 7, 108, 100, 108, 111, 99, 46, 50, + 7, 108, 100, 108, 111, 99, 46, 51, + 7, 115, 116, 108, 111, 99, 46, 48, + 7, 115, 116, 108, 111, 99, 46, 49, + 7, 115, 116, 108, 111, 99, 46, 50, + 7, 115, 116, 108, 111, 99, 46, 51, + 7, 108, 100, 97, 114, 103, 46, 115, + 8, 108, 100, 97, 114, 103, 97, 46, 115, + 7, 115, 116, 97, 114, 103, 46, 115, + 7, 108, 100, 108, 111, 99, 46, 115, + 8, 108, 100, 108, 111, 99, 97, 46, 115, + 7, 115, 116, 108, 111, 99, 46, 115, + 6, 108, 100, 110, 117, 108, 108, + 9, 108, 100, 99, 46, 105, 52, 46, 109, 49, + 8, 108, 100, 99, 46, 105, 52, 46, 48, + 8, 108, 100, 99, 46, 105, 52, 46, 49, + 8, 108, 100, 99, 46, 105, 52, 46, 50, + 8, 108, 100, 99, 46, 105, 52, 46, 51, + 8, 108, 100, 99, 46, 105, 52, 46, 52, + 8, 108, 100, 99, 46, 105, 52, 46, 53, + 8, 108, 100, 99, 46, 105, 52, 46, 54, + 8, 108, 100, 99, 46, 105, 52, 46, 55, + 8, 108, 100, 99, 46, 105, 52, 46, 56, + 8, 108, 100, 99, 46, 105, 52, 46, 115, + 6, 108, 100, 99, 46, 105, 52, + 6, 108, 100, 99, 46, 105, 56, + 6, 108, 100, 99, 46, 114, 52, + 6, 108, 100, 99, 46, 114, 56, + 3, 100, 117, 112, + 3, 112, 111, 112, + 3, 106, 109, 112, + 4, 99, 97, 108, 108, + 5, 99, 97, 108, 108, 105, + 3, 114, 101, 116, + 4, 98, 114, 46, 115, + 9, 98, 114, 102, 97, 108, 115, 101, 46, 115, + 8, 98, 114, 116, 114, 117, 101, 46, 115, + 5, 98, 101, 113, 46, 115, + 5, 98, 103, 101, 46, 115, + 5, 98, 103, 116, 46, 115, + 5, 98, 108, 101, 46, 115, + 5, 98, 108, 116, 46, 115, + 8, 98, 110, 101, 46, 117, 110, 46, 115, + 8, 98, 103, 101, 46, 117, 110, 46, 115, + 8, 98, 103, 116, 46, 117, 110, 46, 115, + 8, 98, 108, 101, 46, 117, 110, 46, 115, + 8, 98, 108, 116, 46, 117, 110, 46, 115, + 2, 98, 114, + 7, 98, 114, 102, 97, 108, 115, 101, + 6, 98, 114, 116, 114, 117, 101, + 3, 98, 101, 113, + 3, 98, 103, 101, + 3, 98, 103, 116, + 3, 98, 108, 101, + 3, 98, 108, 116, + 6, 98, 110, 101, 46, 117, 110, + 6, 98, 103, 101, 46, 117, 110, + 6, 98, 103, 116, 46, 117, 110, + 6, 98, 108, 101, 46, 117, 110, + 6, 98, 108, 116, 46, 117, 110, + 6, 115, 119, 105, 116, 99, 104, + 8, 108, 100, 105, 110, 100, 46, 105, 49, + 8, 108, 100, 105, 110, 100, 46, 117, 49, + 8, 108, 100, 105, 110, 100, 46, 105, 50, + 8, 108, 100, 105, 110, 100, 46, 117, 50, + 8, 108, 100, 105, 110, 100, 46, 105, 52, + 8, 108, 100, 105, 110, 100, 46, 117, 52, + 8, 108, 100, 105, 110, 100, 46, 105, 56, + 7, 108, 100, 105, 110, 100, 46, 105, + 8, 108, 100, 105, 110, 100, 46, 114, 52, + 8, 108, 100, 105, 110, 100, 46, 114, 56, + 9, 108, 100, 105, 110, 100, 46, 114, 101, 102, + 9, 115, 116, 105, 110, 100, 46, 114, 101, 102, + 8, 115, 116, 105, 110, 100, 46, 105, 49, + 8, 115, 116, 105, 110, 100, 46, 105, 50, + 8, 115, 116, 105, 110, 100, 46, 105, 52, + 8, 115, 116, 105, 110, 100, 46, 105, 56, + 8, 115, 116, 105, 110, 100, 46, 114, 52, + 8, 115, 116, 105, 110, 100, 46, 114, 56, + 3, 97, 100, 100, + 3, 115, 117, 98, + 3, 109, 117, 108, + 3, 100, 105, 118, + 6, 100, 105, 118, 46, 117, 110, + 3, 114, 101, 109, + 6, 114, 101, 109, 46, 117, 110, + 3, 97, 110, 100, + 2, 111, 114, + 3, 120, 111, 114, + 3, 115, 104, 108, + 3, 115, 104, 114, + 6, 115, 104, 114, 46, 117, 110, + 3, 110, 101, 103, + 3, 110, 111, 116, + 7, 99, 111, 110, 118, 46, 105, 49, + 7, 99, 111, 110, 118, 46, 105, 50, + 7, 99, 111, 110, 118, 46, 105, 52, + 7, 99, 111, 110, 118, 46, 105, 56, + 7, 99, 111, 110, 118, 46, 114, 52, + 7, 99, 111, 110, 118, 46, 114, 56, + 7, 99, 111, 110, 118, 46, 117, 52, + 7, 99, 111, 110, 118, 46, 117, 56, + 8, 99, 97, 108, 108, 118, 105, 114, 116, + 5, 99, 112, 111, 98, 106, + 5, 108, 100, 111, 98, 106, + 5, 108, 100, 115, 116, 114, + 6, 110, 101, 119, 111, 98, 106, + 9, 99, 97, 115, 116, 99, 108, 97, 115, 115, + 6, 105, 115, 105, 110, 115, 116, + 9, 99, 111, 110, 118, 46, 114, 46, 117, 110, + 5, 117, 110, 98, 111, 120, + 5, 116, 104, 114, 111, 119, + 5, 108, 100, 102, 108, 100, + 6, 108, 100, 102, 108, 100, 97, + 5, 115, 116, 102, 108, 100, + 6, 108, 100, 115, 102, 108, 100, + 7, 108, 100, 115, 102, 108, 100, 97, + 6, 115, 116, 115, 102, 108, 100, + 5, 115, 116, 111, 98, 106, + 14, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, 49, 46, 117, 110, + 14, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, 50, 46, 117, 110, + 14, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, 52, 46, 117, 110, + 14, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, 56, 46, 117, 110, + 14, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, 49, 46, 117, 110, + 14, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, 50, 46, 117, 110, + 14, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, 52, 46, 117, 110, + 14, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, 56, 46, 117, 110, + 13, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, 46, 117, 110, + 13, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, 46, 117, 110, + 3, 98, 111, 120, + 6, 110, 101, 119, 97, 114, 114, + 5, 108, 100, 108, 101, 110, + 7, 108, 100, 101, 108, 101, 109, 97, + 9, 108, 100, 101, 108, 101, 109, 46, 105, 49, + 9, 108, 100, 101, 108, 101, 109, 46, 117, 49, + 9, 108, 100, 101, 108, 101, 109, 46, 105, 50, + 9, 108, 100, 101, 108, 101, 109, 46, 117, 50, + 9, 108, 100, 101, 108, 101, 109, 46, 105, 52, + 9, 108, 100, 101, 108, 101, 109, 46, 117, 52, + 9, 108, 100, 101, 108, 101, 109, 46, 105, 56, + 8, 108, 100, 101, 108, 101, 109, 46, 105, + 9, 108, 100, 101, 108, 101, 109, 46, 114, 52, + 9, 108, 100, 101, 108, 101, 109, 46, 114, 56, + 10, 108, 100, 101, 108, 101, 109, 46, 114, 101, 102, + 8, 115, 116, 101, 108, 101, 109, 46, 105, + 9, 115, 116, 101, 108, 101, 109, 46, 105, 49, + 9, 115, 116, 101, 108, 101, 109, 46, 105, 50, + 9, 115, 116, 101, 108, 101, 109, 46, 105, 52, + 9, 115, 116, 101, 108, 101, 109, 46, 105, 56, + 9, 115, 116, 101, 108, 101, 109, 46, 114, 52, + 9, 115, 116, 101, 108, 101, 109, 46, 114, 56, + 10, 115, 116, 101, 108, 101, 109, 46, 114, 101, 102, + 10, 108, 100, 101, 108, 101, 109, 46, 97, 110, 121, + 10, 115, 116, 101, 108, 101, 109, 46, 97, 110, 121, + 9, 117, 110, 98, 111, 120, 46, 97, 110, 121, + 11, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, 49, + 11, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, 49, + 11, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, 50, + 11, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, 50, + 11, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, 52, + 11, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, 52, + 11, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, 56, + 11, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, 56, + 9, 114, 101, 102, 97, 110, 121, 118, 97, 108, + 8, 99, 107, 102, 105, 110, 105, 116, 101, + 8, 109, 107, 114, 101, 102, 97, 110, 121, + 7, 108, 100, 116, 111, 107, 101, 110, + 7, 99, 111, 110, 118, 46, 117, 50, + 7, 99, 111, 110, 118, 46, 117, 49, + 6, 99, 111, 110, 118, 46, 105, + 10, 99, 111, 110, 118, 46, 111, 118, 102, 46, 105, + 10, 99, 111, 110, 118, 46, 111, 118, 102, 46, 117, + 7, 97, 100, 100, 46, 111, 118, 102, + 10, 97, 100, 100, 46, 111, 118, 102, 46, 117, 110, + 7, 109, 117, 108, 46, 111, 118, 102, + 10, 109, 117, 108, 46, 111, 118, 102, 46, 117, 110, + 7, 115, 117, 98, 46, 111, 118, 102, + 10, 115, 117, 98, 46, 111, 118, 102, 46, 117, 110, + 10, 101, 110, 100, 102, 105, 110, 97, 108, 108, 121, + 5, 108, 101, 97, 118, 101, + 7, 108, 101, 97, 118, 101, 46, 115, + 7, 115, 116, 105, 110, 100, 46, 105, + 6, 99, 111, 110, 118, 46, 117, + 7, 97, 114, 103, 108, 105, 115, 116, + 3, 99, 101, 113, + 3, 99, 103, 116, + 6, 99, 103, 116, 46, 117, 110, + 3, 99, 108, 116, + 6, 99, 108, 116, 46, 117, 110, + 5, 108, 100, 102, 116, 110, + 9, 108, 100, 118, 105, 114, 116, 102, 116, 110, + 5, 108, 100, 97, 114, 103, + 6, 108, 100, 97, 114, 103, 97, + 5, 115, 116, 97, 114, 103, + 5, 108, 100, 108, 111, 99, + 6, 108, 100, 108, 111, 99, 97, + 5, 115, 116, 108, 111, 99, + 8, 108, 111, 99, 97, 108, 108, 111, 99, + 9, 101, 110, 100, 102, 105, 108, 116, 101, 114, + 10, 117, 110, 97, 108, 105, 103, 110, 101, 100, 46, + 9, 118, 111, 108, 97, 116, 105, 108, 101, 46, + 5, 116, 97, 105, 108, 46, + 7, 105, 110, 105, 116, 111, 98, 106, + 12, 99, 111, 110, 115, 116, 114, 97, 105, 110, 101, 100, 46, + 5, 99, 112, 98, 108, 107, + 7, 105, 110, 105, 116, 98, 108, 107, + 3, 110, 111, 46, + 7, 114, 101, 116, 104, 114, 111, 119, + 6, 115, 105, 122, 101, 111, 102, + 10, 114, 101, 102, 97, 110, 121, 116, 121, 112, 101, + 9, 114, 101, 97, 100, 111, 110, 108, 121, 46, + }; + + names = new string [219]; + + for (int i = 0, p = 0; i < names.Length; i++) { + var buffer = new char [table [p++]]; + + for (int j = 0; j < buffer.Length; j++) + buffer [j] = (char) table [p++]; + + names [i] = new string (buffer); + } + } } } diff --git a/Mono.Cecil/Mono.Cecil.Cil/OpCodes.cs b/Mono.Cecil/Mono.Cecil.Cil/OpCodes.cs index ce468a19c..85712ec8b 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/OpCodes.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/OpCodes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Cil/SequencePoint.cs b/Mono.Cecil/Mono.Cecil.Cil/SequencePoint.cs index 189b5f52b..ef87e30f1 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/SequencePoint.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/SequencePoint.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Cil/Symbols.cs b/Mono.Cecil/Mono.Cecil.Cil/Symbols.cs index ba2e694fc..426c4a7e1 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/Symbols.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/Symbols.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -151,10 +151,15 @@ namespace Mono.Cecil.Cil { get { return local_var_token; } } - public MethodSymbols (string methodName) + internal MethodSymbols (string methodName) { this.method_name = methodName; } + + public MethodSymbols (MetadataToken methodToken) + { + this.method_token = methodToken; + } } public delegate Instruction InstructionMapper (int offset); diff --git a/Mono.Cecil/Mono.Cecil.Cil/VariableDefinition.cs b/Mono.Cecil/Mono.Cecil.Cil/VariableDefinition.cs index 690543e97..f501bca6e 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/VariableDefinition.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/VariableDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Cil/VariableReference.cs b/Mono.Cecil/Mono.Cecil.Cil/VariableReference.cs index 545384550..ce0b4cdb4 100644 --- a/Mono.Cecil/Mono.Cecil.Cil/VariableReference.cs +++ b/Mono.Cecil/Mono.Cecil.Cil/VariableReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/BlobHeap.cs b/Mono.Cecil/Mono.Cecil.Metadata/BlobHeap.cs index 81c775e01..e7e2928c8 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/BlobHeap.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/BlobHeap.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/Buffers.cs b/Mono.Cecil/Mono.Cecil.Metadata/Buffers.cs index e8759d742..1c54fdb36 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/Buffers.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/Buffers.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -261,7 +261,7 @@ namespace Mono.Cecil.Metadata { abstract class HeapBuffer : ByteBuffer { public bool IsLarge { - get { return base.length > 65536; } + get { return base.length > 65535; } } public abstract bool IsEmpty { get; } diff --git a/Mono.Cecil/Mono.Cecil.Metadata/CodedIndex.cs b/Mono.Cecil/Mono.Cecil.Metadata/CodedIndex.cs index 62677263d..3e30fd87f 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/CodedIndex.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/CodedIndex.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/ElementType.cs b/Mono.Cecil/Mono.Cecil.Metadata/ElementType.cs index 1ede042b5..72fc1ccaf 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/ElementType.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/ElementType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/GuidHeap.cs b/Mono.Cecil/Mono.Cecil.Metadata/GuidHeap.cs index 19acdab51..1adc0795e 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/GuidHeap.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/GuidHeap.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/Heap.cs b/Mono.Cecil/Mono.Cecil.Metadata/Heap.cs index e7ff72059..bc21acde2 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/Heap.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/Heap.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/MetadataToken.cs b/Mono.Cecil/Mono.Cecil.Metadata/MetadataToken.cs index 8c1338e94..bda56b0f4 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/MetadataToken.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/MetadataToken.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/Row.cs b/Mono.Cecil/Mono.Cecil.Metadata/Row.cs index ab491a6e2..dfda00a77 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/Row.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/Row.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/StringHeap.cs b/Mono.Cecil/Mono.Cecil.Metadata/StringHeap.cs index 85a289213..4a0a0af43 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/StringHeap.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/StringHeap.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/TableHeap.cs b/Mono.Cecil/Mono.Cecil.Metadata/TableHeap.cs index cc441db25..9bc0edd36 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/TableHeap.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/TableHeap.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -62,6 +62,8 @@ namespace Mono.Cecil.Metadata { TypeSpec = 0x1b, ImplMap = 0x1c, FieldRVA = 0x1d, + EncLog = 0x1e, + EncMap = 0x1f, Assembly = 0x20, AssemblyProcessor = 0x21, AssemblyOS = 0x22, @@ -88,53 +90,9 @@ namespace Mono.Cecil.Metadata { public long Valid; public long Sorted; - public static readonly Table [] TableIdentifiers = new [] { - Table.Module, - Table.TypeRef, - Table.TypeDef, - Table.FieldPtr, - Table.Field, - Table.MethodPtr, - Table.Method, - Table.ParamPtr, - Table.Param, - Table.InterfaceImpl, - Table.MemberRef, - Table.Constant, - Table.CustomAttribute, - Table.FieldMarshal, - Table.DeclSecurity, - Table.ClassLayout, - Table.FieldLayout, - Table.StandAloneSig, - Table.EventMap, - Table.EventPtr, - Table.Event, - Table.PropertyMap, - Table.PropertyPtr, - Table.Property, - Table.MethodSemantics, - Table.MethodImpl, - Table.ModuleRef, - Table.TypeSpec, - Table.ImplMap, - Table.FieldRVA, - Table.Assembly, - Table.AssemblyProcessor, - Table.AssemblyOS, - Table.AssemblyRef, - Table.AssemblyRefProcessor, - Table.AssemblyRefOS, - Table.File, - Table.ExportedType, - Table.ManifestResource, - Table.NestedClass, - Table.GenericParam, - Table.MethodSpec, - Table.GenericParamConstraint, - }; + public const int TableCount = 45; - public readonly TableInformation [] Tables = new TableInformation [45]; + public readonly TableInformation [] Tables = new TableInformation [TableCount]; public TableInformation this [Table table] { get { return Tables [(int) table]; } diff --git a/Mono.Cecil/Mono.Cecil.Metadata/TokenType.cs b/Mono.Cecil/Mono.Cecil.Metadata/TokenType.cs index f822b6dd9..2c2010ff9 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/TokenType.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/TokenType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/UserStringHeap.cs b/Mono.Cecil/Mono.Cecil.Metadata/UserStringHeap.cs index 7353cb705..59105087f 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/UserStringHeap.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/UserStringHeap.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.Metadata/Utilities.cs b/Mono.Cecil/Mono.Cecil.Metadata/Utilities.cs index 496c61b51..d752b24b1 100644 --- a/Mono.Cecil/Mono.Cecil.Metadata/Utilities.cs +++ b/Mono.Cecil/Mono.Cecil.Metadata/Utilities.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.PE/BinaryStreamReader.cs b/Mono.Cecil/Mono.Cecil.PE/BinaryStreamReader.cs index 8f5b38e16..ec2477c3a 100644 --- a/Mono.Cecil/Mono.Cecil.PE/BinaryStreamReader.cs +++ b/Mono.Cecil/Mono.Cecil.PE/BinaryStreamReader.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.PE/BinaryStreamWriter.cs b/Mono.Cecil/Mono.Cecil.PE/BinaryStreamWriter.cs index 37189cb66..2bf6cccfa 100644 --- a/Mono.Cecil/Mono.Cecil.PE/BinaryStreamWriter.cs +++ b/Mono.Cecil/Mono.Cecil.PE/BinaryStreamWriter.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.PE/ByteBuffer.cs b/Mono.Cecil/Mono.Cecil.PE/ByteBuffer.cs index 4303b6d56..1f94cde00 100644 --- a/Mono.Cecil/Mono.Cecil.PE/ByteBuffer.cs +++ b/Mono.Cecil/Mono.Cecil.PE/ByteBuffer.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.PE/ByteBufferEqualityComparer.cs b/Mono.Cecil/Mono.Cecil.PE/ByteBufferEqualityComparer.cs index fe56a6f18..70e89164c 100644 --- a/Mono.Cecil/Mono.Cecil.PE/ByteBufferEqualityComparer.cs +++ b/Mono.Cecil/Mono.Cecil.PE/ByteBufferEqualityComparer.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.PE/DataDirectory.cs b/Mono.Cecil/Mono.Cecil.PE/DataDirectory.cs index 5ba2d2d55..fedd0e2dd 100644 --- a/Mono.Cecil/Mono.Cecil.PE/DataDirectory.cs +++ b/Mono.Cecil/Mono.Cecil.PE/DataDirectory.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.PE/Image.cs b/Mono.Cecil/Mono.Cecil.PE/Image.cs index 11aba8fd2..9a04494f0 100644 --- a/Mono.Cecil/Mono.Cecil.PE/Image.cs +++ b/Mono.Cecil/Mono.Cecil.PE/Image.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.PE/ImageReader.cs b/Mono.Cecil/Mono.Cecil.PE/ImageReader.cs index a228c1ffe..ebd4c6b85 100644 --- a/Mono.Cecil/Mono.Cecil.PE/ImageReader.cs +++ b/Mono.Cecil/Mono.Cecil.PE/ImageReader.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -416,12 +416,11 @@ namespace Mono.Cecil.PE { // Sorted 8 heap.Sorted = ReadInt64 (); - for (int i = 0; i < TableHeap.TableIdentifiers.Length; i++) { - var table = TableHeap.TableIdentifiers [i]; - if (!heap.HasTable (table)) + for (int i = 0; i < TableHeap.TableCount; i++) { + if (!heap.HasTable ((Table) i)) continue; - heap.Tables [(int) table].Length = ReadUInt32 (); + heap.Tables [i].Length = ReadUInt32 (); } SetIndexSize (image.StringHeap, sizes, 0x1); @@ -459,8 +458,8 @@ namespace Mono.Cecil.PE { var heap = image.TableHeap; var tables = heap.Tables; - for (int i = 0; i < TableHeap.TableIdentifiers.Length; i++) { - var table = TableHeap.TableIdentifiers [i]; + for (int i = 0; i < TableHeap.TableCount; i++) { + var table = (Table) i; if (!heap.HasTable (table)) continue; @@ -595,6 +594,10 @@ namespace Mono.Cecil.PE { size = 4 // RVA + GetTableIndexSize (Table.Field); // Field break; + case Table.EncLog: + case Table.EncMap: + size = 4; + break; case Table.Assembly: size = 16 // HashAlgId 4, Version 4 * 2, Flags 4 + blobidx_size // PublicKey @@ -655,12 +658,10 @@ namespace Mono.Cecil.PE { throw new NotSupportedException (); } - int index = (int) table; - - tables [index].RowSize = (uint) size; - tables [index].Offset = offset; + tables [i].RowSize = (uint) size; + tables [i].Offset = offset; - offset += (uint) size * tables [index].Length; + offset += (uint) size * tables [i].Length; } } diff --git a/Mono.Cecil/Mono.Cecil.PE/ImageWriter.cs b/Mono.Cecil/Mono.Cecil.PE/ImageWriter.cs index 939de6b95..6f921d9b5 100644 --- a/Mono.Cecil/Mono.Cecil.PE/ImageWriter.cs +++ b/Mono.Cecil/Mono.Cecil.PE/ImageWriter.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.PE/Section.cs b/Mono.Cecil/Mono.Cecil.PE/Section.cs index 54935f989..6a4c7bab7 100644 --- a/Mono.Cecil/Mono.Cecil.PE/Section.cs +++ b/Mono.Cecil/Mono.Cecil.PE/Section.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.PE/TextMap.cs b/Mono.Cecil/Mono.Cecil.PE/TextMap.cs index daeda0cff..047a4c1d4 100644 --- a/Mono.Cecil/Mono.Cecil.PE/TextMap.cs +++ b/Mono.Cecil/Mono.Cecil.PE/TextMap.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil.nuspec b/Mono.Cecil/Mono.Cecil.nuspec new file mode 100644 index 000000000..62ad4b048 --- /dev/null +++ b/Mono.Cecil/Mono.Cecil.nuspec @@ -0,0 +1,23 @@ + + + + Mono.Cecil + 0.9.4.1 + Mono.Cecil + Jb Evain + Jb Evain + http://opensource.org/licenses/mit-license.php + false + http://github.com/jbevain/cecil/ + Cecil is a library written by Jb Evain to generate and inspect programs and libraries in the ECMA CIL format. + Cecil is a library written by Jb Evain to generate and inspect programs and libraries in the ECMA CIL format. It has full support for generics, and support some debugging symbol format. In simple English, with Cecil, you can load existing managed assemblies, browse all the contained types, modify them on the fly and save back to the disk the modified assembly. + en-US + assembly assemblies module modules il cil msil bytecode reflection injection cecil mono aop + + + + + + + + diff --git a/Mono.Cecil/Mono.Cecil/ArrayType.cs b/Mono.Cecil/Mono.Cecil/ArrayType.cs index e3a060f7b..55c59d872 100644 --- a/Mono.Cecil/Mono.Cecil/ArrayType.cs +++ b/Mono.Cecil/Mono.Cecil/ArrayType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/AssemblyDefinition.cs b/Mono.Cecil/Mono.Cecil/AssemblyDefinition.cs index 5ed27c431..f4e69cfed 100644 --- a/Mono.Cecil/Mono.Cecil/AssemblyDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/AssemblyDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -64,7 +64,7 @@ namespace Mono.Cecil { if (main_module.HasImage) return main_module.Read (ref modules, this, (_, reader) => reader.ReadModules ()); - return modules = new Collection { main_module }; + return modules = new Collection (1) { main_module }; } } diff --git a/Mono.Cecil/Mono.Cecil/AssemblyFlags.cs b/Mono.Cecil/Mono.Cecil/AssemblyFlags.cs index 6d04c59c4..e466e7844 100644 --- a/Mono.Cecil/Mono.Cecil/AssemblyFlags.cs +++ b/Mono.Cecil/Mono.Cecil/AssemblyFlags.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/AssemblyHashAlgorithm.cs b/Mono.Cecil/Mono.Cecil/AssemblyHashAlgorithm.cs index 0e7bf838b..79a5699db 100644 --- a/Mono.Cecil/Mono.Cecil/AssemblyHashAlgorithm.cs +++ b/Mono.Cecil/Mono.Cecil/AssemblyHashAlgorithm.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/AssemblyInfo.cs b/Mono.Cecil/Mono.Cecil/AssemblyInfo.cs index b7019815b..ffac8eab6 100644 --- a/Mono.Cecil/Mono.Cecil/AssemblyInfo.cs +++ b/Mono.Cecil/Mono.Cecil/AssemblyInfo.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/AssemblyLinkedResource.cs b/Mono.Cecil/Mono.Cecil/AssemblyLinkedResource.cs index 68e44f80b..4d8bac0bb 100644 --- a/Mono.Cecil/Mono.Cecil/AssemblyLinkedResource.cs +++ b/Mono.Cecil/Mono.Cecil/AssemblyLinkedResource.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/AssemblyNameDefinition.cs b/Mono.Cecil/Mono.Cecil/AssemblyNameDefinition.cs index 4756cb81a..dc6b9057f 100644 --- a/Mono.Cecil/Mono.Cecil/AssemblyNameDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/AssemblyNameDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/AssemblyNameReference.cs b/Mono.Cecil/Mono.Cecil/AssemblyNameReference.cs index ae834015d..3f8c862bf 100644 --- a/Mono.Cecil/Mono.Cecil/AssemblyNameReference.cs +++ b/Mono.Cecil/Mono.Cecil/AssemblyNameReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/AssemblyReader.cs b/Mono.Cecil/Mono.Cecil/AssemblyReader.cs index ffc148678..6aa5c4415 100644 --- a/Mono.Cecil/Mono.Cecil/AssemblyReader.cs +++ b/Mono.Cecil/Mono.Cecil/AssemblyReader.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -374,7 +374,7 @@ namespace Mono.Cecil { this.image = module.Image; this.module = module; this.metadata = module.MetadataSystem; - this.code = CodeReader.CreateCodeReader (this); + this.code = new CodeReader (image.MetadataSection, this); } int GetCodedIndexSize (CodedIndex index) @@ -501,7 +501,12 @@ namespace Mono.Cecil { PopulateVersionAndFlags (reference); - reference.PublicKeyToken = ReadBlob (); + var key_or_token = ReadBlob (); + + if (reference.HasPublicKey) + reference.PublicKey = key_or_token; + else + reference.PublicKeyToken = key_or_token; PopulateNameAndCulture (reference); @@ -1123,14 +1128,19 @@ namespace Mono.Cecil { var fields = new MemberDefinitionCollection (type, (int) fields_range.Length); this.context = type; - MoveTo (Table.Field, fields_range.Start); - for (uint i = 0; i < fields_range.Length; i++) - fields.Add (ReadField (fields_range.Start + i)); + if (!MoveTo (Table.FieldPtr, fields_range.Start)) { + if (!MoveTo (Table.Field, fields_range.Start)) + return fields; + + for (uint i = 0; i < fields_range.Length; i++) + ReadField (fields_range.Start + i, fields); + } else + ReadPointers (Table.FieldPtr, Table.Field, fields_range, fields, ReadField); return fields; } - FieldDefinition ReadField (uint field_rid) + void ReadField (uint field_rid, Collection fields) { var attributes = (FieldAttributes) ReadUInt16 (); var name = ReadString (); @@ -1140,7 +1150,10 @@ namespace Mono.Cecil { field.token = new MetadataToken (TokenType.Field, field_rid); metadata.AddFieldDefinition (field); - return field; + if (IsDeleted (field)) + return; + + fields.Add (field); } void InitializeFields () @@ -1308,18 +1321,24 @@ namespace Mono.Cecil { metadata.RemoveEventsRange (type); - if (range.Length == 0 || !MoveTo (Table.Event, range.Start)) + if (range.Length == 0) return events; this.context = type; - for (uint i = 0; i < range.Length; i++) - events.Add (ReadEvent (range.Start + i)); + if (!MoveTo (Table.EventPtr, range.Start)) { + if (!MoveTo (Table.Event, range.Start)) + return events; + + for (uint i = 0; i < range.Length; i++) + ReadEvent (range.Start + i, events); + } else + ReadPointers (Table.EventPtr, Table.Event, range, events, ReadEvent); return events; } - EventDefinition ReadEvent (uint event_rid) + void ReadEvent (uint event_rid, Collection events) { var attributes = (EventAttributes) ReadUInt16 (); var name = ReadString (); @@ -1327,7 +1346,11 @@ namespace Mono.Cecil { var @event = new EventDefinition (name, attributes, event_type); @event.token = new MetadataToken (TokenType.Event, event_rid); - return @event; + + if (IsDeleted (@event)) + return; + + events.Add (@event); } void InitializeEvents () @@ -1375,18 +1398,23 @@ namespace Mono.Cecil { var properties = new MemberDefinitionCollection (type, (int) range.Length); - if (range.Length == 0 || !MoveTo (Table.Property, range.Start)) + if (range.Length == 0) return properties; this.context = type; - for (uint i = 0; i < range.Length; i++) - properties.Add (ReadProperty (range.Start + i)); + if (!MoveTo (Table.PropertyPtr, range.Start)) { + if (!MoveTo (Table.Property, range.Start)) + return properties; + for (uint i = 0; i < range.Length; i++) + ReadProperty (range.Start + i, properties); + } else + ReadPointers (Table.PropertyPtr, Table.Property, range, properties, ReadProperty); return properties; } - PropertyDefinition ReadProperty (uint property_rid) + void ReadProperty (uint property_rid, Collection properties) { var attributes = (PropertyAttributes) ReadUInt16 (); var name = ReadString (); @@ -1408,7 +1436,10 @@ namespace Mono.Cecil { property.HasThis = has_this; property.token = new MetadataToken (TokenType.Property, property_rid); - return property; + if (IsDeleted (property)) + return; + + properties.Add (property); } void InitializeProperties () @@ -1578,14 +1609,36 @@ namespace Mono.Cecil { return new MemberDefinitionCollection (type); var methods = new MemberDefinitionCollection (type, (int) methods_range.Length); + if (!MoveTo (Table.MethodPtr, methods_range.Start)) { + if (!MoveTo (Table.Method, methods_range.Start)) + return methods; - MoveTo (Table.Method, methods_range.Start); - for (uint i = 0; i < methods_range.Length; i++) - ReadMethod (methods_range.Start + i, methods); + for (uint i = 0; i < methods_range.Length; i++) + ReadMethod (methods_range.Start + i, methods); + } else + ReadPointers (Table.MethodPtr, Table.Method, methods_range, methods, ReadMethod); return methods; } + void ReadPointers (Table ptr, Table table, Range range, Collection members, Action> reader) + where TMember : IMemberDefinition + { + for (uint i = 0; i < range.Length; i++) { + MoveTo (ptr, range.Start + i); + + var rid = ReadTableIndex (table); + MoveTo (table, rid); + + reader (rid, members); + } + } + + static bool IsDeleted (IMemberDefinition member) + { + return member.IsSpecialName && member.Name == "_Deleted"; + } + void InitializeMethods () { if (metadata.Methods != null) @@ -1603,6 +1656,9 @@ namespace Mono.Cecil { method.Name = ReadString (); method.token = new MetadataToken (TokenType.Method, method_rid); + if (IsDeleted (method)) + return; + methods.Add (method); // attach method var signature = ReadBlobIndex (); @@ -1623,22 +1679,44 @@ namespace Mono.Cecil { void ReadParameters (MethodDefinition method, Range param_range) { - MoveTo (Table.Param, param_range.Start); - for (uint i = 0; i < param_range.Length; i++) { - var attributes = (ParameterAttributes) ReadUInt16 (); - var sequence = ReadUInt16 (); - var name = ReadString (); + if (!MoveTo (Table.ParamPtr, param_range.Start)) { + if (!MoveTo (Table.Param, param_range.Start)) + return; + + for (uint i = 0; i < param_range.Length; i++) + ReadParameter (param_range.Start + i, method); + } else + ReadParameterPointers (method, param_range); + } + + void ReadParameterPointers (MethodDefinition method, Range range) + { + for (uint i = 0; i < range.Length; i++) { + MoveTo (Table.ParamPtr, range.Start + i); + + var rid = ReadTableIndex (Table.Param); - var parameter = sequence == 0 - ? method.MethodReturnType.Parameter - : method.Parameters [sequence - 1]; + MoveTo (Table.Param, rid); - parameter.token = new MetadataToken (TokenType.Param, param_range.Start + i); - parameter.Name = name; - parameter.Attributes = attributes; + ReadParameter (rid, method); } } + void ReadParameter (uint param_rid, MethodDefinition method) + { + var attributes = (ParameterAttributes) ReadUInt16 (); + var sequence = ReadUInt16 (); + var name = ReadString (); + + var parameter = sequence == 0 + ? method.MethodReturnType.Parameter + : method.Parameters [sequence - 1]; + + parameter.token = new MetadataToken (TokenType.Param, param_rid); + parameter.Name = name; + parameter.Attributes = attributes; + } + void ReadMethodSignature (uint signature, IMethodSignature method) { var reader = ReadSignature (signature); @@ -1765,7 +1843,7 @@ namespace Mono.Cecil { range.Length++; } - if (owner != MetadataToken.Zero) + if (owner != MetadataToken.Zero && !ranges.ContainsKey (owner)) ranges.Add (owner, range); return ranges; @@ -2398,7 +2476,7 @@ namespace Mono.Cecil { return; } - reader.ReadByte (); + reader.position++; var count = reader.ReadCompressedUInt32 (); var attributes = new Collection ((int) count); @@ -2705,9 +2783,21 @@ namespace Mono.Cecil { public void ReadMethodSignature (IMethodSignature method) { var calling_convention = ReadByte (); + + const byte has_this = 0x20; + const byte explicit_this = 0x40; + + if ((calling_convention & has_this) != 0) { + method.HasThis = true; + calling_convention = (byte) (calling_convention & ~has_this); + } + + if ((calling_convention & explicit_this) != 0) { + method.ExplicitThis = true; + calling_convention = (byte) (calling_convention & ~explicit_this); + } + method.CallingConvention = (MethodCallingConvention) calling_convention; - method.HasThis = (calling_convention & 0x20) != 0; - method.ExplicitThis = (calling_convention & 0x40) != 0; var generic_context = method as MethodReference; if (generic_context != null) @@ -2720,8 +2810,6 @@ namespace Mono.Cecil { CheckGenericContext (generic_context, (int) arity -1 ); } - // TODO: more call_conv - var param_count = ReadCompressedUInt32 (); method.MethodReturnType.ReturnType = ReadTypeSignature (); diff --git a/Mono.Cecil/Mono.Cecil/AssemblyWriter.cs b/Mono.Cecil/Mono.Cecil/AssemblyWriter.cs index 8dd914508..f05bf821c 100644 --- a/Mono.Cecil/Mono.Cecil/AssemblyWriter.cs +++ b/Mono.Cecil/Mono.Cecil/AssemblyWriter.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -1932,21 +1932,13 @@ namespace Mono.Cecil { SignatureWriter GetSecurityDeclarationSignature (SecurityDeclaration declaration) { var signature = CreateSignatureWriter (); - if (!declaration.resolved) { - signature.WriteBytes (declaration.GetBlob ()); - return signature; - } - - signature.WriteByte ((byte) '.'); - - var attributes = declaration.security_attributes; - if (attributes == null) - throw new NotSupportedException (); - signature.WriteCompressedUInt32 ((uint) attributes.Count); - - for (int i = 0; i < attributes.Count; i++) - signature.WriteSecurityAttribute (attributes [i]); + if (!declaration.resolved) + signature.WriteBytes (declaration.GetBlob ()); + else if (module.Runtime < TargetRuntime.Net_2_0) + signature.WriteXmlSecurityDeclaration (declaration); + else + signature.WriteSecurityDeclaration (declaration); return signature; } @@ -2449,7 +2441,7 @@ namespace Mono.Cecil { WriteCustomAttributeFixedArgument (argument.Type, argument); } - public void WriteSecurityAttribute (SecurityAttribute attribute) + void WriteSecurityAttribute (SecurityAttribute attribute) { WriteTypeReference (attribute.AttributeType); @@ -2469,6 +2461,49 @@ namespace Mono.Cecil { WriteBytes (buffer); } + public void WriteSecurityDeclaration (SecurityDeclaration declaration) + { + WriteByte ((byte) '.'); + + var attributes = declaration.security_attributes; + if (attributes == null) + throw new NotSupportedException (); + + WriteCompressedUInt32 ((uint) attributes.Count); + + for (int i = 0; i < attributes.Count; i++) + WriteSecurityAttribute (attributes [i]); + } + + public void WriteXmlSecurityDeclaration (SecurityDeclaration declaration) + { + var xml = GetXmlSecurityDeclaration (declaration); + if (xml == null) + throw new NotSupportedException (); + + WriteBytes (Encoding.Unicode.GetBytes (xml)); + } + + static string GetXmlSecurityDeclaration (SecurityDeclaration declaration) + { + if (declaration.security_attributes == null || declaration.security_attributes.Count != 1) + return null; + + var attribute = declaration.security_attributes [0]; + + if (!attribute.AttributeType.IsTypeOf ("System.Security.Permissions", "PermissionSetAttribute")) + return null; + + if (attribute.properties == null || attribute.properties.Count != 1) + return null; + + var property = attribute.properties [0]; + if (property.Name != "XML") + return null; + + return (string) property.Argument.Value; + } + void WriteTypeReference (TypeReference type) { WriteUTF8String (TypeParser.ToParseable (type)); diff --git a/Mono.Cecil/Mono.Cecil/BaseAssemblyResolver.cs b/Mono.Cecil/Mono.Cecil/BaseAssemblyResolver.cs index 20b5fbe98..140cc96c0 100644 --- a/Mono.Cecil/Mono.Cecil/BaseAssemblyResolver.cs +++ b/Mono.Cecil/Mono.Cecil/BaseAssemblyResolver.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -51,6 +51,21 @@ namespace Mono.Cecil { } } + public class AssemblyResolutionException : FileNotFoundException { + + readonly AssemblyNameReference reference; + + public AssemblyNameReference AssemblyReference { + get { return reference; } + } + + public AssemblyResolutionException (AssemblyNameReference reference) + : base (string.Format ("Failed to resolve assembly: '{0}'", reference)) + { + this.reference = reference; + } + } + public abstract class BaseAssemblyResolver : IAssemblyResolver { static readonly bool on_mono = Type.GetType ("Mono.Runtime") != null; @@ -152,7 +167,7 @@ namespace Mono.Cecil { return assembly; } - throw new FileNotFoundException ("Could not resolve: " + name); + throw new AssemblyResolutionException (name); } AssemblyDefinition SearchDirectory (AssemblyNameReference name, IEnumerable directories, ReaderParameters parameters) diff --git a/Mono.Cecil/Mono.Cecil/CallSite.cs b/Mono.Cecil/Mono.Cecil/CallSite.cs index 4430bd871..2d4ed4175 100644 --- a/Mono.Cecil/Mono.Cecil/CallSite.cs +++ b/Mono.Cecil/Mono.Cecil/CallSite.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -29,11 +29,70 @@ using System; using System.Text; +using Mono.Collections.Generic; + namespace Mono.Cecil { - public sealed class CallSite : MethodReference { + public sealed class CallSite : IMethodSignature { + + readonly MethodReference signature; - public override string FullName { + public bool HasThis { + get { return signature.HasThis; } + set { signature.HasThis = value; } + } + + public bool ExplicitThis { + get { return signature.ExplicitThis; } + set { signature.ExplicitThis = value; } + } + + public MethodCallingConvention CallingConvention { + get { return signature.CallingConvention; } + set { signature.CallingConvention = value; } + } + + public bool HasParameters { + get { return signature.HasParameters; } + } + + public Collection Parameters { + get { return signature.Parameters; } + } + + public TypeReference ReturnType { + get { return signature.MethodReturnType.ReturnType; } + set { signature.MethodReturnType.ReturnType = value; } + } + + public MethodReturnType MethodReturnType { + get { return signature.MethodReturnType; } + } + + public string Name { + get { return string.Empty; } + set { throw new InvalidOperationException (); } + } + + public string Namespace { + get { return string.Empty; } + set { throw new InvalidOperationException (); } + } + + public ModuleDefinition Module { + get { return ReturnType.Module; } + } + + public IMetadataScope Scope { + get { return signature.ReturnType.Scope; } + } + + public MetadataToken MetadataToken { + get { return signature.token; } + set { signature.token = value; } + } + + public string FullName { get { var signature = new StringBuilder (); signature.Append (ReturnType.FullName); @@ -42,13 +101,24 @@ namespace Mono.Cecil { } } - public override ModuleDefinition Module { - get { return ReturnType.Module; } + internal CallSite () + { + this.signature = new MethodReference (); + this.signature.token = new MetadataToken (TokenType.Signature, 0); + } + + public CallSite (TypeReference returnType) + : this () + { + if (returnType == null) + throw new ArgumentNullException ("returnType"); + + this.signature.ReturnType = returnType; } - public override MethodDefinition Resolve () + public override string ToString () { - return null; + return FullName; } } } diff --git a/Mono.Cecil/Mono.Cecil/CustomAttribute.cs b/Mono.Cecil/Mono.Cecil/CustomAttribute.cs index 51ffc52d8..0c12638f9 100644 --- a/Mono.Cecil/Mono.Cecil/CustomAttribute.cs +++ b/Mono.Cecil/Mono.Cecil/CustomAttribute.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/DefaultAssemblyResolver.cs b/Mono.Cecil/Mono.Cecil/DefaultAssemblyResolver.cs index cac7974f9..93d249391 100644 --- a/Mono.Cecil/Mono.Cecil/DefaultAssemblyResolver.cs +++ b/Mono.Cecil/Mono.Cecil/DefaultAssemblyResolver.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/EmbeddedResource.cs b/Mono.Cecil/Mono.Cecil/EmbeddedResource.cs index bb9f1f957..e12dd0b37 100644 --- a/Mono.Cecil/Mono.Cecil/EmbeddedResource.cs +++ b/Mono.Cecil/Mono.Cecil/EmbeddedResource.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/EventAttributes.cs b/Mono.Cecil/Mono.Cecil/EventAttributes.cs index b5b097d4f..815efa57b 100644 --- a/Mono.Cecil/Mono.Cecil/EventAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/EventAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/EventDefinition.cs b/Mono.Cecil/Mono.Cecil/EventDefinition.cs index 006aa4d47..a78f76f3b 100644 --- a/Mono.Cecil/Mono.Cecil/EventDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/EventDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/EventReference.cs b/Mono.Cecil/Mono.Cecil/EventReference.cs index bd1b0f7e4..8952002d6 100644 --- a/Mono.Cecil/Mono.Cecil/EventReference.cs +++ b/Mono.Cecil/Mono.Cecil/EventReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ExportedType.cs b/Mono.Cecil/Mono.Cecil/ExportedType.cs index fab7379bc..c25f8d05e 100644 --- a/Mono.Cecil/Mono.Cecil/ExportedType.cs +++ b/Mono.Cecil/Mono.Cecil/ExportedType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/FieldAttributes.cs b/Mono.Cecil/Mono.Cecil/FieldAttributes.cs index 947a8770a..dd6bf361d 100644 --- a/Mono.Cecil/Mono.Cecil/FieldAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/FieldAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/FieldDefinition.cs b/Mono.Cecil/Mono.Cecil/FieldDefinition.cs index caa4898c2..f992b2bb4 100644 --- a/Mono.Cecil/Mono.Cecil/FieldDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/FieldDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/FieldReference.cs b/Mono.Cecil/Mono.Cecil/FieldReference.cs index 1c812bb90..be58d3d06 100644 --- a/Mono.Cecil/Mono.Cecil/FieldReference.cs +++ b/Mono.Cecil/Mono.Cecil/FieldReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/FileAttributes.cs b/Mono.Cecil/Mono.Cecil/FileAttributes.cs index 6c2781c62..4d3b6ca7f 100644 --- a/Mono.Cecil/Mono.Cecil/FileAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/FileAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/FunctionPointerType.cs b/Mono.Cecil/Mono.Cecil/FunctionPointerType.cs index f7bf08c3f..db80f7621 100644 --- a/Mono.Cecil/Mono.Cecil/FunctionPointerType.cs +++ b/Mono.Cecil/Mono.Cecil/FunctionPointerType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/GenericInstanceMethod.cs b/Mono.Cecil/Mono.Cecil/GenericInstanceMethod.cs index d5d8d4ecd..dbe720df5 100644 --- a/Mono.Cecil/Mono.Cecil/GenericInstanceMethod.cs +++ b/Mono.Cecil/Mono.Cecil/GenericInstanceMethod.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -42,12 +42,7 @@ namespace Mono.Cecil { } public Collection GenericArguments { - get { - if (arguments == null) - arguments = new Collection (); - - return arguments; - } + get { return arguments ?? (arguments = new Collection ()); } } public override bool IsGenericInstance { diff --git a/Mono.Cecil/Mono.Cecil/GenericInstanceType.cs b/Mono.Cecil/Mono.Cecil/GenericInstanceType.cs index 46c048bcd..6554ff0e8 100644 --- a/Mono.Cecil/Mono.Cecil/GenericInstanceType.cs +++ b/Mono.Cecil/Mono.Cecil/GenericInstanceType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -44,12 +44,7 @@ namespace Mono.Cecil { } public Collection GenericArguments { - get { - if (arguments == null) - arguments = new Collection (); - - return arguments; - } + get { return arguments ?? (arguments = new Collection ()); } } public override TypeReference DeclaringType { diff --git a/Mono.Cecil/Mono.Cecil/GenericParameter.cs b/Mono.Cecil/Mono.Cecil/GenericParameter.cs index 133371075..43891241e 100644 --- a/Mono.Cecil/Mono.Cecil/GenericParameter.cs +++ b/Mono.Cecil/Mono.Cecil/GenericParameter.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -97,10 +97,6 @@ namespace Mono.Cecil { get { return custom_attributes ?? (this.GetCustomAttributes (ref custom_attributes, Module)); } } - internal new bool HasImage { - get { return Module != null && Module.HasImage; } - } - public override IMetadataScope Scope { get { if (owner.GenericParameterType == GenericParameterType.Method) diff --git a/Mono.Cecil/Mono.Cecil/GenericParameterAttributes.cs b/Mono.Cecil/Mono.Cecil/GenericParameterAttributes.cs index 89996140e..6d77956de 100644 --- a/Mono.Cecil/Mono.Cecil/GenericParameterAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/GenericParameterAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/IConstantProvider.cs b/Mono.Cecil/Mono.Cecil/IConstantProvider.cs index a3eaacc7c..74dab4049 100644 --- a/Mono.Cecil/Mono.Cecil/IConstantProvider.cs +++ b/Mono.Cecil/Mono.Cecil/IConstantProvider.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ICustomAttributeProvider.cs b/Mono.Cecil/Mono.Cecil/ICustomAttributeProvider.cs index f67f209f1..bd7c847dc 100644 --- a/Mono.Cecil/Mono.Cecil/ICustomAttributeProvider.cs +++ b/Mono.Cecil/Mono.Cecil/ICustomAttributeProvider.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/IGenericInstance.cs b/Mono.Cecil/Mono.Cecil/IGenericInstance.cs index 2750ad0a6..edc406ca1 100644 --- a/Mono.Cecil/Mono.Cecil/IGenericInstance.cs +++ b/Mono.Cecil/Mono.Cecil/IGenericInstance.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/IGenericParameterProvider.cs b/Mono.Cecil/Mono.Cecil/IGenericParameterProvider.cs index 19ff98da8..0d542b039 100644 --- a/Mono.Cecil/Mono.Cecil/IGenericParameterProvider.cs +++ b/Mono.Cecil/Mono.Cecil/IGenericParameterProvider.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/IMarshalInfoProvider.cs b/Mono.Cecil/Mono.Cecil/IMarshalInfoProvider.cs index 8e3cbce0f..e3daeb3c2 100644 --- a/Mono.Cecil/Mono.Cecil/IMarshalInfoProvider.cs +++ b/Mono.Cecil/Mono.Cecil/IMarshalInfoProvider.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/IMemberDefinition.cs b/Mono.Cecil/Mono.Cecil/IMemberDefinition.cs index 09878f78f..ee73d9da4 100644 --- a/Mono.Cecil/Mono.Cecil/IMemberDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/IMemberDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/IMetadataScope.cs b/Mono.Cecil/Mono.Cecil/IMetadataScope.cs index f0ab506e5..04a022810 100644 --- a/Mono.Cecil/Mono.Cecil/IMetadataScope.cs +++ b/Mono.Cecil/Mono.Cecil/IMetadataScope.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/IMetadataTokenProvider.cs b/Mono.Cecil/Mono.Cecil/IMetadataTokenProvider.cs index ff7772481..6621835b2 100644 --- a/Mono.Cecil/Mono.Cecil/IMetadataTokenProvider.cs +++ b/Mono.Cecil/Mono.Cecil/IMetadataTokenProvider.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/IMethodSignature.cs b/Mono.Cecil/Mono.Cecil/IMethodSignature.cs index 6bae56adc..491deec5d 100644 --- a/Mono.Cecil/Mono.Cecil/IMethodSignature.cs +++ b/Mono.Cecil/Mono.Cecil/IMethodSignature.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/Import.cs b/Mono.Cecil/Mono.Cecil/Import.cs index 93e700e8a..2a8293c0c 100644 --- a/Mono.Cecil/Mono.Cecil/Import.cs +++ b/Mono.Cecil/Mono.Cecil/Import.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/LinkedResource.cs b/Mono.Cecil/Mono.Cecil/LinkedResource.cs index a5530fc13..16c1d59b5 100644 --- a/Mono.Cecil/Mono.Cecil/LinkedResource.cs +++ b/Mono.Cecil/Mono.Cecil/LinkedResource.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ManifestResourceAttributes.cs b/Mono.Cecil/Mono.Cecil/ManifestResourceAttributes.cs index d72d1d0c7..7d6bb190f 100644 --- a/Mono.Cecil/Mono.Cecil/ManifestResourceAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/ManifestResourceAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MarshalInfo.cs b/Mono.Cecil/Mono.Cecil/MarshalInfo.cs index 1fce23a8d..9d5873892 100644 --- a/Mono.Cecil/Mono.Cecil/MarshalInfo.cs +++ b/Mono.Cecil/Mono.Cecil/MarshalInfo.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MemberDefinitionCollection.cs b/Mono.Cecil/Mono.Cecil/MemberDefinitionCollection.cs index 1e703026e..707f36fb9 100644 --- a/Mono.Cecil/Mono.Cecil/MemberDefinitionCollection.cs +++ b/Mono.Cecil/Mono.Cecil/MemberDefinitionCollection.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MemberReference.cs b/Mono.Cecil/Mono.Cecil/MemberReference.cs index b3edf3997..b658c513d 100644 --- a/Mono.Cecil/Mono.Cecil/MemberReference.cs +++ b/Mono.Cecil/Mono.Cecil/MemberReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MetadataResolver.cs b/Mono.Cecil/Mono.Cecil/MetadataResolver.cs index a2b76c74f..0b912e362 100644 --- a/Mono.Cecil/Mono.Cecil/MetadataResolver.cs +++ b/Mono.Cecil/Mono.Cecil/MetadataResolver.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -206,6 +206,12 @@ namespace Mono.Cecil { if (method.Name != reference.Name) continue; + if (method.HasGenericParameters != reference.HasGenericParameters) + continue; + + if (method.HasGenericParameters && method.GenericParameters.Count != reference.GenericParameters.Count) + continue; + if (!AreSame (method.ReturnType, reference.ReturnType)) continue; @@ -275,12 +281,6 @@ namespace Mono.Cecil { static bool AreSame (GenericInstanceType a, GenericInstanceType b) { - if (!a.HasGenericArguments) - return !b.HasGenericArguments; - - if (!b.HasGenericArguments) - return false; - if (a.GenericArguments.Count != b.GenericArguments.Count) return false; @@ -298,6 +298,12 @@ namespace Mono.Cecil { static bool AreSame (TypeReference a, TypeReference b) { + if (ReferenceEquals (a, b)) + return true; + + if (a == null || b == null) + return false; + if (a.etype != b.etype) return false; @@ -307,7 +313,12 @@ namespace Mono.Cecil { if (a.IsTypeSpecification ()) return AreSame ((TypeSpecification) a, (TypeSpecification) b); - return a.FullName == b.FullName; + if (a.Name != b.Name || a.Namespace != b.Namespace) + return false; + + //TODO: check scope + + return AreSame (a.DeclaringType, b.DeclaringType); } } } diff --git a/Mono.Cecil/Mono.Cecil/MetadataSystem.cs b/Mono.Cecil/Mono.Cecil/MetadataSystem.cs index 4d65674e8..bfe7fc58f 100644 --- a/Mono.Cecil/Mono.Cecil/MetadataSystem.cs +++ b/Mono.Cecil/Mono.Cecil/MetadataSystem.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MethodAttributes.cs b/Mono.Cecil/Mono.Cecil/MethodAttributes.cs index 3446702b5..626a97b3e 100644 --- a/Mono.Cecil/Mono.Cecil/MethodAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/MethodAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MethodCallingConvention.cs b/Mono.Cecil/Mono.Cecil/MethodCallingConvention.cs index c96dc1cf2..bd7188dbe 100644 --- a/Mono.Cecil/Mono.Cecil/MethodCallingConvention.cs +++ b/Mono.Cecil/Mono.Cecil/MethodCallingConvention.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MethodDefinition.cs b/Mono.Cecil/Mono.Cecil/MethodDefinition.cs index 68a849ad7..81a0f1b73 100644 --- a/Mono.Cecil/Mono.Cecil/MethodDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/MethodDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MethodImplAttributes.cs b/Mono.Cecil/Mono.Cecil/MethodImplAttributes.cs index 8a2b422cc..94d8771a9 100644 --- a/Mono.Cecil/Mono.Cecil/MethodImplAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/MethodImplAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MethodReference.cs b/Mono.Cecil/Mono.Cecil/MethodReference.cs index 6a9dbe926..21de33673 100644 --- a/Mono.Cecil/Mono.Cecil/MethodReference.cs +++ b/Mono.Cecil/Mono.Cecil/MethodReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MethodReturnType.cs b/Mono.Cecil/Mono.Cecil/MethodReturnType.cs index 045b9a876..f2d3c00f8 100644 --- a/Mono.Cecil/Mono.Cecil/MethodReturnType.cs +++ b/Mono.Cecil/Mono.Cecil/MethodReturnType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MethodSemanticsAttributes.cs b/Mono.Cecil/Mono.Cecil/MethodSemanticsAttributes.cs index f44a3fa81..dd0f4742c 100644 --- a/Mono.Cecil/Mono.Cecil/MethodSemanticsAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/MethodSemanticsAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/MethodSpecification.cs b/Mono.Cecil/Mono.Cecil/MethodSpecification.cs index e907d6cc0..73b5c14ad 100644 --- a/Mono.Cecil/Mono.Cecil/MethodSpecification.cs +++ b/Mono.Cecil/Mono.Cecil/MethodSpecification.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/Modifiers.cs b/Mono.Cecil/Mono.Cecil/Modifiers.cs index f7ff611ac..ad31bc04f 100644 --- a/Mono.Cecil/Mono.Cecil/Modifiers.cs +++ b/Mono.Cecil/Mono.Cecil/Modifiers.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ModuleDefinition.cs b/Mono.Cecil/Mono.Cecil/ModuleDefinition.cs index 71e56efe1..70cfb1aa0 100644 --- a/Mono.Cecil/Mono.Cecil/ModuleDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/ModuleDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -447,7 +447,7 @@ namespace Mono.Cecil { if (!HasImage) return false; - return Read (this, (_, reader) => reader.GetTypeReference (scope, fullName) != null); + return GetTypeReference (scope, fullName) != null; } public bool TryGetTypeReference (string fullName, out TypeReference type) @@ -464,7 +464,12 @@ namespace Mono.Cecil { return false; } - return (type = Read (this, (_, reader) => reader.GetTypeReference (scope, fullName))) != null; + return (type = GetTypeReference (scope, fullName)) != null; + } + + TypeReference GetTypeReference (string scope, string fullname) + { + return Read (new Row (scope, fullname), (row, reader) => reader.GetTypeReference (row.Col1, row.Col2)); } public IEnumerable GetTypeReferences () @@ -763,7 +768,7 @@ namespace Mono.Cecil { public IMetadataTokenProvider LookupToken (MetadataToken token) { - return Read (this, (_, reader) => reader.LookupToken (token)); + return Read (token, (t, reader) => reader.LookupToken (t)); } readonly object module_lock = new object(); diff --git a/Mono.Cecil/Mono.Cecil/ModuleKind.cs b/Mono.Cecil/Mono.Cecil/ModuleKind.cs index eb57890a9..e5f745824 100644 --- a/Mono.Cecil/Mono.Cecil/ModuleKind.cs +++ b/Mono.Cecil/Mono.Cecil/ModuleKind.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ModuleReference.cs b/Mono.Cecil/Mono.Cecil/ModuleReference.cs index 0b6e49aba..3934b3ceb 100644 --- a/Mono.Cecil/Mono.Cecil/ModuleReference.cs +++ b/Mono.Cecil/Mono.Cecil/ModuleReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/NativeType.cs b/Mono.Cecil/Mono.Cecil/NativeType.cs index afa107f07..88da9805e 100644 --- a/Mono.Cecil/Mono.Cecil/NativeType.cs +++ b/Mono.Cecil/Mono.Cecil/NativeType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/PInvokeAttributes.cs b/Mono.Cecil/Mono.Cecil/PInvokeAttributes.cs index 1389c93ad..bb3683825 100644 --- a/Mono.Cecil/Mono.Cecil/PInvokeAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/PInvokeAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/PInvokeInfo.cs b/Mono.Cecil/Mono.Cecil/PInvokeInfo.cs index 9a273d550..cfd817c8d 100644 --- a/Mono.Cecil/Mono.Cecil/PInvokeInfo.cs +++ b/Mono.Cecil/Mono.Cecil/PInvokeInfo.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ParameterAttributes.cs b/Mono.Cecil/Mono.Cecil/ParameterAttributes.cs index 8c12b5481..e0bc825d8 100644 --- a/Mono.Cecil/Mono.Cecil/ParameterAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/ParameterAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ParameterDefinition.cs b/Mono.Cecil/Mono.Cecil/ParameterDefinition.cs index ec916975f..6a4d96c86 100644 --- a/Mono.Cecil/Mono.Cecil/ParameterDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/ParameterDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ParameterDefinitionCollection.cs b/Mono.Cecil/Mono.Cecil/ParameterDefinitionCollection.cs index 86538bb9a..bd8b1c139 100644 --- a/Mono.Cecil/Mono.Cecil/ParameterDefinitionCollection.cs +++ b/Mono.Cecil/Mono.Cecil/ParameterDefinitionCollection.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ParameterReference.cs b/Mono.Cecil/Mono.Cecil/ParameterReference.cs index cfe648f2e..46b057cd9 100644 --- a/Mono.Cecil/Mono.Cecil/ParameterReference.cs +++ b/Mono.Cecil/Mono.Cecil/ParameterReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/PinnedType.cs b/Mono.Cecil/Mono.Cecil/PinnedType.cs index d5e7a80c0..ff59cfb7e 100644 --- a/Mono.Cecil/Mono.Cecil/PinnedType.cs +++ b/Mono.Cecil/Mono.Cecil/PinnedType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/PointerType.cs b/Mono.Cecil/Mono.Cecil/PointerType.cs index 54ab77519..a142e1440 100644 --- a/Mono.Cecil/Mono.Cecil/PointerType.cs +++ b/Mono.Cecil/Mono.Cecil/PointerType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/PropertyAttributes.cs b/Mono.Cecil/Mono.Cecil/PropertyAttributes.cs index ad6fd9e8f..1be0413f2 100644 --- a/Mono.Cecil/Mono.Cecil/PropertyAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/PropertyAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/PropertyDefinition.cs b/Mono.Cecil/Mono.Cecil/PropertyDefinition.cs index 43b459e63..39ffcbf66 100644 --- a/Mono.Cecil/Mono.Cecil/PropertyDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/PropertyDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -127,6 +127,8 @@ namespace Mono.Cecil { public bool HasParameters { get { + InitializeMethods (); + if (get_method != null) return get_method.HasParameters; diff --git a/Mono.Cecil/Mono.Cecil/PropertyReference.cs b/Mono.Cecil/Mono.Cecil/PropertyReference.cs index d9a2c19ef..0dcfc952f 100644 --- a/Mono.Cecil/Mono.Cecil/PropertyReference.cs +++ b/Mono.Cecil/Mono.Cecil/PropertyReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/ReferenceType.cs b/Mono.Cecil/Mono.Cecil/ReferenceType.cs index 3a6b326d4..7940c617c 100644 --- a/Mono.Cecil/Mono.Cecil/ReferenceType.cs +++ b/Mono.Cecil/Mono.Cecil/ReferenceType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/Resource.cs b/Mono.Cecil/Mono.Cecil/Resource.cs index 0432ae789..eff7f41aa 100644 --- a/Mono.Cecil/Mono.Cecil/Resource.cs +++ b/Mono.Cecil/Mono.Cecil/Resource.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/SecurityDeclaration.cs b/Mono.Cecil/Mono.Cecil/SecurityDeclaration.cs index 8fcfcc458..7f1608bd6 100644 --- a/Mono.Cecil/Mono.Cecil/SecurityDeclaration.cs +++ b/Mono.Cecil/Mono.Cecil/SecurityDeclaration.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -142,7 +142,7 @@ namespace Mono.Cecil { if (!HasImage || signature == 0) throw new NotSupportedException (); - return module.Read (this, (declaration, reader) => reader.ReadSecurityDeclarationBlob (declaration.signature)); ; + return module.Read (this, (declaration, reader) => reader.ReadSecurityDeclarationBlob (declaration.signature)); } void Resolve () diff --git a/Mono.Cecil/Mono.Cecil/SentinelType.cs b/Mono.Cecil/Mono.Cecil/SentinelType.cs index d0d5a1d1e..664d75bfd 100644 --- a/Mono.Cecil/Mono.Cecil/SentinelType.cs +++ b/Mono.Cecil/Mono.Cecil/SentinelType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/TargetRuntime.cs b/Mono.Cecil/Mono.Cecil/TargetRuntime.cs index 9931fc611..9b49a5f77 100644 --- a/Mono.Cecil/Mono.Cecil/TargetRuntime.cs +++ b/Mono.Cecil/Mono.Cecil/TargetRuntime.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/TypeAttributes.cs b/Mono.Cecil/Mono.Cecil/TypeAttributes.cs index 6e263e8e6..bc4e18f33 100644 --- a/Mono.Cecil/Mono.Cecil/TypeAttributes.cs +++ b/Mono.Cecil/Mono.Cecil/TypeAttributes.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/TypeDefinition.cs b/Mono.Cecil/Mono.Cecil/TypeDefinition.cs index dd0564aa1..bdb5bcf06 100644 --- a/Mono.Cecil/Mono.Cecil/TypeDefinition.cs +++ b/Mono.Cecil/Mono.Cecil/TypeDefinition.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -161,10 +161,6 @@ namespace Mono.Cecil { } } - internal new bool HasImage { - get { return Module != null && Module.HasImage; } - } - public bool HasMethods { get { if (methods != null) diff --git a/Mono.Cecil/Mono.Cecil/TypeDefinitionCollection.cs b/Mono.Cecil/Mono.Cecil/TypeDefinitionCollection.cs index 702fe271e..eae712282 100644 --- a/Mono.Cecil/Mono.Cecil/TypeDefinitionCollection.cs +++ b/Mono.Cecil/Mono.Cecil/TypeDefinitionCollection.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/TypeParser.cs b/Mono.Cecil/Mono.Cecil/TypeParser.cs index 4da4d6be1..733c422d2 100644 --- a/Mono.Cecil/Mono.Cecil/TypeParser.cs +++ b/Mono.Cecil/Mono.Cecil/TypeParser.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/TypeReference.cs b/Mono.Cecil/Mono.Cecil/TypeReference.cs index 596ae6994..f4861245f 100644 --- a/Mono.Cecil/Mono.Cecil/TypeReference.cs +++ b/Mono.Cecil/Mono.Cecil/TypeReference.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/TypeSpecification.cs b/Mono.Cecil/Mono.Cecil/TypeSpecification.cs index da4e72643..aa9b653f0 100644 --- a/Mono.Cecil/Mono.Cecil/TypeSpecification.cs +++ b/Mono.Cecil/Mono.Cecil/TypeSpecification.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Cecil/TypeSystem.cs b/Mono.Cecil/Mono.Cecil/TypeSystem.cs index 16dfdce46..f2d079d5a 100644 --- a/Mono.Cecil/Mono.Cecil/TypeSystem.cs +++ b/Mono.Cecil/Mono.Cecil/TypeSystem.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -47,7 +47,7 @@ namespace Mono.Cecil { if (metadata.Types == null) Initialize (module.Types); - return module.Read (this, (_, reader) => { + return module.Read (new Row (@namespace, name), (row, reader) => { var types = reader.metadata.Types; for (int i = 0; i < types.Length; i++) { @@ -56,7 +56,7 @@ namespace Mono.Cecil { var type = types [i]; - if (type.Name == name && type.Namespace == @namespace) + if (type.Name == row.Col2 && type.Namespace == row.Col1) return type; } diff --git a/Mono.Cecil/Mono.Cecil/VariantType.cs b/Mono.Cecil/Mono.Cecil/VariantType.cs index 86d6daaa6..76562f6e6 100644 --- a/Mono.Cecil/Mono.Cecil/VariantType.cs +++ b/Mono.Cecil/Mono.Cecil/VariantType.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono.Collections.Generic/Collection.cs b/Mono.Cecil/Mono.Collections.Generic/Collection.cs index 1137978aa..4d9271760 100644 --- a/Mono.Cecil/Mono.Collections.Generic/Collection.cs +++ b/Mono.Cecil/Mono.Collections.Generic/Collection.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -115,6 +115,9 @@ namespace Mono.Collections.Generic { public Collection (ICollection items) { + if (items == null) + throw new ArgumentNullException ("items"); + this.items = new T [items.Count]; items.CopyTo (this.items, 0); this.size = this.items.Length; diff --git a/Mono.Cecil/Mono.Collections.Generic/ReadOnlyCollection.cs b/Mono.Cecil/Mono.Collections.Generic/ReadOnlyCollection.cs index bd467c9b8..7f24df699 100644 --- a/Mono.Cecil/Mono.Collections.Generic/ReadOnlyCollection.cs +++ b/Mono.Cecil/Mono.Collections.Generic/ReadOnlyCollection.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -44,6 +44,10 @@ namespace Mono.Collections.Generic { get { return true; } } + bool IList.IsFixedSize { + get { return true; } + } + bool IList.IsReadOnly { get { return true; } } @@ -57,8 +61,7 @@ namespace Mono.Collections.Generic { if (array == null) throw new ArgumentNullException (); - this.items = array; - this.size = array.Length; + Initialize (array, array.Length); } public ReadOnlyCollection (Collection collection) @@ -66,8 +69,14 @@ namespace Mono.Collections.Generic { if (collection == null) throw new ArgumentNullException (); - this.items = collection.items; - this.size = collection.size; + Initialize (collection.items, collection.size); + } + + void Initialize (T [] items, int size) + { + this.items = new T [size]; + Array.Copy (items, 0, this.items, 0, size); + this.size = size; } internal override void Grow (int desired) diff --git a/Mono.Cecil/Mono.Security.Cryptography/CryptoService.cs b/Mono.Cecil/Mono.Security.Cryptography/CryptoService.cs index f504f5eb6..58b6cfabc 100644 --- a/Mono.Cecil/Mono.Security.Cryptography/CryptoService.cs +++ b/Mono.Cecil/Mono.Security.Cryptography/CryptoService.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono/Actions.cs b/Mono.Cecil/Mono/Actions.cs index 071b14988..756438f84 100644 --- a/Mono.Cecil/Mono/Actions.cs +++ b/Mono.Cecil/Mono/Actions.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -30,7 +30,7 @@ namespace Mono { //delegate void Action (); - //delegate void Action (T1 arg1, T2 arg2); + delegate void Action (T1 arg1, T2 arg2); //delegate void Action (T1 arg1, T2 arg2, T3 arg3); //delegate void Action (T1 arg1, T2 arg2, T3 arg3, T4 arg4); } diff --git a/Mono.Cecil/Mono/Empty.cs b/Mono.Cecil/Mono/Empty.cs index 70739af58..8701d7bb9 100644 --- a/Mono.Cecil/Mono/Empty.cs +++ b/Mono.Cecil/Mono/Empty.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Mono/Funcs.cs b/Mono.Cecil/Mono/Funcs.cs index 40f222595..87bc6e977 100644 --- a/Mono.Cecil/Mono/Funcs.cs +++ b/Mono.Cecil/Mono/Funcs.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/System.Runtime.CompilerServices/ExtensionAttribute.cs b/Mono.Cecil/System.Runtime.CompilerServices/ExtensionAttribute.cs index ae79cda72..bb24f980d 100644 --- a/Mono.Cecil/System.Runtime.CompilerServices/ExtensionAttribute.cs +++ b/Mono.Cecil/System.Runtime.CompilerServices/ExtensionAttribute.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/Test/Mono.Cecil.Tests/SecurityDeclarationTests.cs b/Mono.Cecil/Test/Mono.Cecil.Tests/SecurityDeclarationTests.cs index 5bc74e732..a04150366 100644 --- a/Mono.Cecil/Test/Mono.Cecil.Tests/SecurityDeclarationTests.cs +++ b/Mono.Cecil/Test/Mono.Cecil.Tests/SecurityDeclarationTests.cs @@ -51,6 +51,43 @@ namespace Mono.Cecil.Tests { Assert.AreEqual (permission_set, argument.Value); } + [TestModule ("decsec1-xml.dll")] + public void XmlNet_1_1SecurityDeclaration (ModuleDefinition module) + { + var type = module.GetType ("SubLibrary"); + + Assert.IsTrue (type.HasSecurityDeclarations); + + Assert.AreEqual (1, type.SecurityDeclarations.Count); + + var declaration = type.SecurityDeclarations [0]; + Assert.AreEqual (SecurityAction.Deny, declaration.Action); + + Assert.AreEqual (1, declaration.SecurityAttributes.Count); + + var attribute = declaration.SecurityAttributes [0]; + + Assert.AreEqual ("System.Security.Permissions.PermissionSetAttribute", attribute.AttributeType.FullName); + + Assert.AreEqual (1, attribute.Properties.Count); + + var named_argument = attribute.Properties [0]; + + Assert.AreEqual ("XML", named_argument.Name); + + var argument = named_argument.Argument; + + Assert.AreEqual ("System.String", argument.Type.FullName); + + const string permission_set = "\r\n\r\n\r\n"; + + Assert.AreEqual (permission_set, argument.Value); + } + [TestModule ("decsec-att.dll")] public void AttributeSecurityDeclaration (ModuleDefinition module) { diff --git a/Mono.Cecil/Test/Resources/assemblies/decsec1-xml.dll b/Mono.Cecil/Test/Resources/assemblies/decsec1-xml.dll new file mode 100644 index 0000000000000000000000000000000000000000..d898c2ab3cbb215a23c5b1edb6ebf4a4cf0d5212 GIT binary patch literal 4096 zcmeHKOK%%h6#m9ZBikXNpsEB3l}Svc%7tm%q)c;Qq*U3o%5m=se0}yxP4|L^GKPkVuVtne=YV-Fhhq~zE_A$YAU8Uw<$>oY$)(a?k8{>JsvLrJ zPSi=<0-YH*$Yjs-q52JQF!_5lXRJI#n5EroDcKuW(=d7~caZ7;Gw4E|{Dm$D7_nN5 z$=@9$qHb%ha#d7hba+e$_Gr-!VX)UuV+qzmYD#ql*$&-nX18_Ny&}r!_;1=g!$d_ty==jT# zEYWFI>RDQtqV^Y76K98PnhyxZ?WOP&MS zoaTHzi*f*E6scRnW$HT>ksLI7Z&6Z6Xbp$(WybYkQ74ISM=m6~4-)R@>UZ2S4IgdO z*{Ke<6J3Ejpy7oC8yLi`y!gJzx9x8IGq8&)e;Fzh%8 zGaI;KeX8sj4P{5luDr44xkkfv;YD^3x{if;#|q7`jatj)2dcJ)8fn5^0mjCmM>sMc%-1wd+RsQBHQ&@yT2oDY-{u~7GQKKw|4x7DX zCh{{FqqI#rrp|+rtg*RwA)kqsN6{H#pXIMc+IwogQE-MzvTZv5@?@`-E zonAg8<#WA-xA-%0ioQ?bP1faYOkk4QahxW-Q~ji}=V;l)GGmvjF43k(-cMu-4aOG` zE9y>k>wThUz0;jf_vGftes?^2C!XH!kbaQ9ly_I&R-3bQh4hL@TD$LzvHi|?7CK}5 zxl!YJckvXjKw2<%qlXb-rx$@O>hp&ZZ^K#(N zt=Xy>JAq$c34_lg4Q_UamJ7@eLhC~PA3AsK?V68gf^gP#7fgp=K)E$3mE53Y)#g#? Y)$Pmon$y$&Eq;4vuMO|pdm1Y6AFNgto&W#< literal 0 HcmV?d00001 diff --git a/Mono.Cecil/rocks/Mono.Cecil.Rocks/AssemblyInfo.cs b/Mono.Cecil/rocks/Mono.Cecil.Rocks/AssemblyInfo.cs index ae2b650eb..ca7827e1d 100644 --- a/Mono.Cecil/rocks/Mono.Cecil.Rocks/AssemblyInfo.cs +++ b/Mono.Cecil/rocks/Mono.Cecil.Rocks/AssemblyInfo.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/rocks/Mono.Cecil.Rocks/Functional.cs b/Mono.Cecil/rocks/Mono.Cecil.Rocks/Functional.cs index a6f1a45ba..0e61b47bc 100644 --- a/Mono.Cecil/rocks/Mono.Cecil.Rocks/Functional.cs +++ b/Mono.Cecil/rocks/Mono.Cecil.Rocks/Functional.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/rocks/Mono.Cecil.Rocks/ILParser.cs b/Mono.Cecil/rocks/Mono.Cecil.Rocks/ILParser.cs index 3fb014e32..6f745bc12 100644 --- a/Mono.Cecil/rocks/Mono.Cecil.Rocks/ILParser.cs +++ b/Mono.Cecil/rocks/Mono.Cecil.Rocks/ILParser.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -99,7 +99,7 @@ namespace Mono.Cecil.Rocks { static ParseContext CreateContext (MethodDefinition method, IILVisitor visitor) { - var code = method.Module.Read (method, (_, reader) => CodeReader.CreateCodeReader (reader)); + var code = method.Module.Read (method, (_, reader) => new CodeReader (reader.image.MetadataSection, reader)); return new ParseContext { Code = code, diff --git a/Mono.Cecil/rocks/Mono.Cecil.Rocks/MethodBodyRocks.cs b/Mono.Cecil/rocks/Mono.Cecil.Rocks/MethodBodyRocks.cs index 236b687ce..f141f6084 100644 --- a/Mono.Cecil/rocks/Mono.Cecil.Rocks/MethodBodyRocks.cs +++ b/Mono.Cecil/rocks/Mono.Cecil.Rocks/MethodBodyRocks.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/rocks/Mono.Cecil.Rocks/MethodDefinitionRocks.cs b/Mono.Cecil/rocks/Mono.Cecil.Rocks/MethodDefinitionRocks.cs index c011af26c..c2f758d2e 100644 --- a/Mono.Cecil/rocks/Mono.Cecil.Rocks/MethodDefinitionRocks.cs +++ b/Mono.Cecil/rocks/Mono.Cecil.Rocks/MethodDefinitionRocks.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/rocks/Mono.Cecil.Rocks/ModuleDefinitionRocks.cs b/Mono.Cecil/rocks/Mono.Cecil.Rocks/ModuleDefinitionRocks.cs index db77417ae..5aaf73ce9 100644 --- a/Mono.Cecil/rocks/Mono.Cecil.Rocks/ModuleDefinitionRocks.cs +++ b/Mono.Cecil/rocks/Mono.Cecil.Rocks/ModuleDefinitionRocks.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/rocks/Mono.Cecil.Rocks/SecurityDeclarationRocks.cs b/Mono.Cecil/rocks/Mono.Cecil.Rocks/SecurityDeclarationRocks.cs index 7b1f82dae..b84696fc6 100644 --- a/Mono.Cecil/rocks/Mono.Cecil.Rocks/SecurityDeclarationRocks.cs +++ b/Mono.Cecil/rocks/Mono.Cecil.Rocks/SecurityDeclarationRocks.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/rocks/Mono.Cecil.Rocks/TypeDefinitionRocks.cs b/Mono.Cecil/rocks/Mono.Cecil.Rocks/TypeDefinitionRocks.cs index f5173af50..74b7f087f 100644 --- a/Mono.Cecil/rocks/Mono.Cecil.Rocks/TypeDefinitionRocks.cs +++ b/Mono.Cecil/rocks/Mono.Cecil.Rocks/TypeDefinitionRocks.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/rocks/Mono.Cecil.Rocks/TypeReferenceRocks.cs b/Mono.Cecil/rocks/Mono.Cecil.Rocks/TypeReferenceRocks.cs index 0ceb51b5c..5748b178f 100644 --- a/Mono.Cecil/rocks/Mono.Cecil.Rocks/TypeReferenceRocks.cs +++ b/Mono.Cecil/rocks/Mono.Cecil.Rocks/TypeReferenceRocks.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.cs b/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.cs index a08113a31..277272a5f 100644 --- a/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.cs +++ b/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs b/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs index 0198a7164..2db041965 100644 --- a/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs +++ b/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/MdbWriter.cs b/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/MdbWriter.cs index 54362ec3c..6f4aa20e3 100644 --- a/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/MdbWriter.cs +++ b/Mono.Cecil/symbols/mdb/Mono.Cecil.Mdb/MdbWriter.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/AssemblyInfo.cs b/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/AssemblyInfo.cs index a9a7b90db..8144f7a72 100644 --- a/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/AssemblyInfo.cs +++ b/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/AssemblyInfo.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbHelper.cs b/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbHelper.cs index c5d4882ea..79e82dbd5 100644 --- a/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbHelper.cs +++ b/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbHelper.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbReader.cs b/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbReader.cs index 59bfa1bac..cd3c7f46e 100644 --- a/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbReader.cs +++ b/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbReader.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the diff --git a/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbWriter.cs b/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbWriter.cs index 24d62078e..d07b69824 100644 --- a/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbWriter.cs +++ b/Mono.Cecil/symbols/pdb/Mono.Cecil.Pdb/PdbWriter.cs @@ -4,7 +4,7 @@ // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2010 Jb Evain +// Copyright (c) 2008 - 2011 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the