You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
2
external/cecil/Mono.Cecil/AssemblyInfo.cs
vendored
2
external/cecil/Mono.Cecil/AssemblyInfo.cs
vendored
@@ -12,7 +12,7 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle ("Mono.Cecil")]
|
||||
[assembly: AssemblyTitle (Consts.AssemblyName)]
|
||||
|
||||
#if !PCL && !NET_CORE
|
||||
[assembly: Guid ("fd225bb4-fa53-44b2-a6db-85f5e48dcb54")]
|
||||
|
||||
@@ -238,8 +238,7 @@ namespace Mono.Cecil {
|
||||
|
||||
public AssemblyNameReference (string name, Version version)
|
||||
{
|
||||
if (name == null)
|
||||
throw new ArgumentNullException ("name");
|
||||
Mixin.CheckName (name);
|
||||
|
||||
this.name = name;
|
||||
this.version = Mixin.CheckVersion (version);
|
||||
|
||||
23
external/cecil/Mono.Cecil/AssemblyReader.cs
vendored
23
external/cecil/Mono.Cecil/AssemblyReader.cs
vendored
@@ -99,7 +99,7 @@ namespace Mono.Cecil {
|
||||
|
||||
#if !PCL
|
||||
if (symbol_reader_provider == null && parameters.ReadSymbols)
|
||||
symbol_reader_provider = SymbolProvider.GetPlatformReaderProvider ();
|
||||
symbol_reader_provider = new DefaultSymbolReaderProvider ();
|
||||
#endif
|
||||
|
||||
if (symbol_reader_provider != null) {
|
||||
@@ -115,7 +115,8 @@ namespace Mono.Cecil {
|
||||
var reader = symbol_reader_provider.GetSymbolReader (module, parameters.SymbolStream);
|
||||
#endif
|
||||
|
||||
module.ReadSymbols (reader);
|
||||
if (reader != null)
|
||||
module.ReadSymbols (reader);
|
||||
}
|
||||
|
||||
if (module.Image.HasDebugTables ())
|
||||
@@ -417,7 +418,7 @@ namespace Mono.Cecil {
|
||||
for (int i = 0; i < methods.Count; i++) {
|
||||
var method = methods [i];
|
||||
|
||||
if (method.HasBody && method.debug_info == null)
|
||||
if (method.HasBody && method.token.RID != 0 && method.debug_info == null)
|
||||
method.debug_info = symbol_reader.Read (method);
|
||||
}
|
||||
}
|
||||
@@ -2859,10 +2860,15 @@ namespace Mono.Cecil {
|
||||
InitializeDocuments ();
|
||||
|
||||
if (!MoveTo (Table.MethodDebugInformation, method.MetadataToken.RID))
|
||||
return new Collection<SequencePoint> ();
|
||||
return new Collection<SequencePoint> (0);
|
||||
|
||||
var document = metadata.GetDocument (ReadTableIndex (Table.Document));
|
||||
var reader = ReadSignature (ReadBlobIndex ());
|
||||
var document_index = ReadTableIndex (Table.Document);
|
||||
var signature = ReadBlobIndex ();
|
||||
if (signature == 0)
|
||||
return new Collection<SequencePoint> (0);
|
||||
|
||||
var document = metadata.GetDocument (document_index);
|
||||
var reader = ReadSignature (signature);
|
||||
|
||||
return reader.ReadSequencePoints (document);
|
||||
}
|
||||
@@ -2991,13 +2997,13 @@ namespace Mono.Cecil {
|
||||
value = Encoding.Unicode.GetString (bytes, 0, bytes.Length);
|
||||
} else
|
||||
value = null;
|
||||
} else if (type.etype == ElementType.Object) {
|
||||
value = null;
|
||||
} else if (type.IsTypeOf ("System", "Decimal")) {
|
||||
var b = signature.ReadByte ();
|
||||
value = new decimal (signature.ReadInt32 (), signature.ReadInt32 (), signature.ReadInt32 (), (b & 0x80) != 0, (byte) (b & 0x7f));
|
||||
} else if (type.IsTypeOf ("System", "DateTime")) {
|
||||
value = new DateTime (signature.ReadInt64());
|
||||
} else if (type.etype == ElementType.Object || type.etype == ElementType.None || type.etype == ElementType.Class) {
|
||||
value = null;
|
||||
} else
|
||||
value = signature.ReadConstantSignature (type.etype);
|
||||
|
||||
@@ -3055,7 +3061,6 @@ namespace Mono.Cecil {
|
||||
byte [] blob;
|
||||
int index, count;
|
||||
|
||||
|
||||
GetBlobView (signature, out blob, out index, out count);
|
||||
if (count == 0)
|
||||
return string.Empty;
|
||||
|
||||
34
external/cecil/Mono.Cecil/AssemblyWriter.cs
vendored
34
external/cecil/Mono.Cecil/AssemblyWriter.cs
vendored
@@ -93,7 +93,7 @@ namespace Mono.Cecil {
|
||||
var symbol_writer_provider = parameters.SymbolWriterProvider;
|
||||
#if !PCL && !NET_CORE
|
||||
if (symbol_writer_provider == null && parameters.WriteSymbols)
|
||||
symbol_writer_provider = SymbolProvider.GetPlatformWriterProvider ();
|
||||
symbol_writer_provider = new DefaultSymbolWriterProvider ();
|
||||
#endif
|
||||
var symbol_writer = GetSymbolWriter (module, fq_name, symbol_writer_provider, parameters);
|
||||
|
||||
@@ -110,6 +110,7 @@ namespace Mono.Cecil {
|
||||
|
||||
var writer = ImageWriter.CreateWriter (module, metadata, stream);
|
||||
|
||||
stream.value.SetLength (0);
|
||||
writer.WriteImage ();
|
||||
|
||||
if (metadata.symbol_writer != null)
|
||||
@@ -157,7 +158,7 @@ namespace Mono.Cecil {
|
||||
public abstract int Length { get; }
|
||||
|
||||
public bool IsLarge {
|
||||
get { return Length > 65535; }
|
||||
get { return Length > ushort.MaxValue; }
|
||||
}
|
||||
|
||||
public abstract void Write (TableHeapBuffer buffer);
|
||||
@@ -866,7 +867,7 @@ namespace Mono.Cecil {
|
||||
this.module = module;
|
||||
this.text_map = CreateTextMap ();
|
||||
this.fq_name = fq_name;
|
||||
this.time_stamp = (uint) DateTime.UtcNow.Subtract (new DateTime (1970, 1, 1)).TotalSeconds;
|
||||
this.time_stamp = module.timestamp;
|
||||
this.symbol_writer_provider = symbol_writer_provider;
|
||||
|
||||
if (symbol_writer == null && module.HasImage && module.Image.HasDebugTables ()) {
|
||||
@@ -1007,6 +1008,8 @@ namespace Mono.Cecil {
|
||||
{
|
||||
BuildModule ();
|
||||
|
||||
table_heap.string_offsets = string_heap.WriteStrings ();
|
||||
table_heap.ComputeTableInformations ();
|
||||
table_heap.WriteTableHeap ();
|
||||
}
|
||||
|
||||
@@ -1265,7 +1268,7 @@ namespace Mono.Cecil {
|
||||
return;
|
||||
|
||||
AttachTokens ();
|
||||
AddTypeDefs ();
|
||||
AddTypes ();
|
||||
AddGenericParameters ();
|
||||
}
|
||||
|
||||
@@ -1274,33 +1277,33 @@ namespace Mono.Cecil {
|
||||
var types = module.Types;
|
||||
|
||||
for (int i = 0; i < types.Count; i++)
|
||||
AttachTypeDefToken (types [i]);
|
||||
AttachTypeToken (types [i]);
|
||||
}
|
||||
|
||||
void AttachTypeDefToken (TypeDefinition type)
|
||||
void AttachTypeToken (TypeDefinition type)
|
||||
{
|
||||
type.token = new MetadataToken (TokenType.TypeDef, type_rid++);
|
||||
type.fields_range.Start = field_rid;
|
||||
type.methods_range.Start = method_rid;
|
||||
|
||||
if (type.HasFields)
|
||||
AttachFieldsDefToken (type);
|
||||
AttachFieldsToken (type);
|
||||
|
||||
if (type.HasMethods)
|
||||
AttachMethodsDefToken (type);
|
||||
AttachMethodsToken (type);
|
||||
|
||||
if (type.HasNestedTypes)
|
||||
AttachNestedTypesDefToken (type);
|
||||
AttachNestedTypesToken (type);
|
||||
}
|
||||
|
||||
void AttachNestedTypesDefToken (TypeDefinition type)
|
||||
void AttachNestedTypesToken (TypeDefinition type)
|
||||
{
|
||||
var nested_types = type.NestedTypes;
|
||||
for (int i = 0; i < nested_types.Count; i++)
|
||||
AttachTypeDefToken (nested_types [i]);
|
||||
AttachTypeToken (nested_types [i]);
|
||||
}
|
||||
|
||||
void AttachFieldsDefToken (TypeDefinition type)
|
||||
void AttachFieldsToken (TypeDefinition type)
|
||||
{
|
||||
var fields = type.Fields;
|
||||
type.fields_range.Length = (uint) fields.Count;
|
||||
@@ -1308,7 +1311,7 @@ namespace Mono.Cecil {
|
||||
fields [i].token = new MetadataToken (TokenType.Field, field_rid++);
|
||||
}
|
||||
|
||||
void AttachMethodsDefToken (TypeDefinition type)
|
||||
void AttachMethodsToken (TypeDefinition type)
|
||||
{
|
||||
var methods = type.Methods;
|
||||
type.methods_range.Length = (uint) methods.Count;
|
||||
@@ -1413,7 +1416,7 @@ namespace Mono.Cecil {
|
||||
return token;
|
||||
}
|
||||
|
||||
void AddTypeDefs ()
|
||||
void AddTypes ()
|
||||
{
|
||||
var types = module.Types;
|
||||
|
||||
@@ -2140,6 +2143,7 @@ namespace Mono.Cecil {
|
||||
case ElementType.SzArray:
|
||||
case ElementType.Class:
|
||||
case ElementType.Object:
|
||||
case ElementType.None:
|
||||
case ElementType.Var:
|
||||
case ElementType.MVar:
|
||||
signature.WriteInt32 (0);
|
||||
@@ -3216,7 +3220,7 @@ namespace Mono.Cecil {
|
||||
|
||||
#endif
|
||||
|
||||
static partial class Mixin {
|
||||
static partial class Mixin {
|
||||
|
||||
public static bool TryGetUniqueDocument (this MethodDebugInformation info, out Document document)
|
||||
{
|
||||
|
||||
@@ -83,19 +83,6 @@ namespace Mono.Cecil {
|
||||
return directories;
|
||||
}
|
||||
|
||||
public virtual AssemblyDefinition Resolve (string fullName)
|
||||
{
|
||||
return Resolve (fullName, new ReaderParameters ());
|
||||
}
|
||||
|
||||
public virtual AssemblyDefinition Resolve (string fullName, ReaderParameters parameters)
|
||||
{
|
||||
if (fullName == null)
|
||||
throw new ArgumentNullException ("fullName");
|
||||
|
||||
return Resolve (AssemblyNameReference.Parse (fullName), parameters);
|
||||
}
|
||||
|
||||
public event AssemblyResolveEventHandler ResolveFailure;
|
||||
|
||||
protected BaseAssemblyResolver ()
|
||||
@@ -118,10 +105,8 @@ namespace Mono.Cecil {
|
||||
|
||||
public virtual AssemblyDefinition Resolve (AssemblyNameReference name, ReaderParameters parameters)
|
||||
{
|
||||
if (name == null)
|
||||
throw new ArgumentNullException ("name");
|
||||
if (parameters == null)
|
||||
parameters = new ReaderParameters ();
|
||||
Mixin.CheckName (name);
|
||||
Mixin.CheckParameters (parameters);
|
||||
|
||||
var assembly = SearchDirectory (name, directories, parameters);
|
||||
if (assembly != null)
|
||||
@@ -171,8 +156,13 @@ namespace Mono.Cecil {
|
||||
foreach (var directory in directories) {
|
||||
foreach (var extension in extensions) {
|
||||
string file = Path.Combine (directory, name.Name + extension);
|
||||
if (File.Exists (file))
|
||||
if (!File.Exists (file))
|
||||
continue;
|
||||
try {
|
||||
return GetAssembly (file, parameters);
|
||||
} catch (System.BadImageFormatException) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
external/cecil/Mono.Cecil/Consts.cs
vendored
Normal file
4
external/cecil/Mono.Cecil/Consts.cs
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
static class Consts
|
||||
{
|
||||
public const string AssemblyName = "Mono.Cecil";
|
||||
}
|
||||
11
external/cecil/Mono.Cecil/CustomAttribute.cs
vendored
11
external/cecil/Mono.Cecil/CustomAttribute.cs
vendored
@@ -200,15 +200,4 @@ namespace Mono.Cecil {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
static partial class Mixin {
|
||||
|
||||
public static void CheckName (string name)
|
||||
{
|
||||
if (name == null)
|
||||
throw new ArgumentNullException ("name");
|
||||
if (name.Length == 0)
|
||||
throw new ArgumentException ("Empty name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,7 @@ namespace Mono.Cecil {
|
||||
|
||||
public override AssemblyDefinition Resolve (AssemblyNameReference name)
|
||||
{
|
||||
if (name == null)
|
||||
throw new ArgumentNullException ("name");
|
||||
Mixin.CheckName (name);
|
||||
|
||||
AssemblyDefinition assembly;
|
||||
if (cache.TryGetValue (name.FullName, out assembly))
|
||||
|
||||
4
external/cecil/Mono.Cecil/EventReference.cs
vendored
4
external/cecil/Mono.Cecil/EventReference.cs
vendored
@@ -28,9 +28,7 @@ namespace Mono.Cecil {
|
||||
protected EventReference (string name, TypeReference eventType)
|
||||
: base (name)
|
||||
{
|
||||
if (eventType == null)
|
||||
throw new ArgumentNullException ("eventType");
|
||||
|
||||
Mixin.CheckType (eventType, Mixin.Argument.eventType);
|
||||
event_type = eventType;
|
||||
}
|
||||
|
||||
|
||||
6
external/cecil/Mono.Cecil/FieldReference.cs
vendored
6
external/cecil/Mono.Cecil/FieldReference.cs
vendored
@@ -37,8 +37,7 @@ namespace Mono.Cecil {
|
||||
public FieldReference (string name, TypeReference fieldType)
|
||||
: base (name)
|
||||
{
|
||||
if (fieldType == null)
|
||||
throw new ArgumentNullException ("fieldType");
|
||||
Mixin.CheckType (fieldType, Mixin.Argument.fieldType);
|
||||
|
||||
this.field_type = fieldType;
|
||||
this.token = new MetadataToken (TokenType.MemberRef);
|
||||
@@ -47,8 +46,7 @@ namespace Mono.Cecil {
|
||||
public FieldReference (string name, TypeReference fieldType, TypeReference declaringType)
|
||||
: this (name, fieldType)
|
||||
{
|
||||
if (declaringType == null)
|
||||
throw new ArgumentNullException("declaringType");
|
||||
Mixin.CheckType (declaringType, Mixin.Argument.declaringType);
|
||||
|
||||
this.DeclaringType = declaringType;
|
||||
}
|
||||
|
||||
@@ -188,8 +188,7 @@ namespace Mono.Cecil {
|
||||
internal GenericParameter (int position, GenericParameterType type, ModuleDefinition module)
|
||||
: base (string.Empty, string.Empty)
|
||||
{
|
||||
if (module == null)
|
||||
throw new ArgumentNullException ();
|
||||
Mixin.CheckModule (module);
|
||||
|
||||
this.position = position;
|
||||
this.type = type;
|
||||
|
||||
2
external/cecil/Mono.Cecil/Import.cs
vendored
2
external/cecil/Mono.Cecil/Import.cs
vendored
@@ -740,7 +740,7 @@ namespace Mono.Cecil {
|
||||
public static void CheckModule (ModuleDefinition module)
|
||||
{
|
||||
if (module == null)
|
||||
throw new ArgumentNullException ("module");
|
||||
throw new ArgumentNullException (Argument.module.ToString ());
|
||||
}
|
||||
|
||||
public static bool TryGetAssemblyNameReference (this ModuleDefinition module, AssemblyNameReference name_reference, out AssemblyNameReference assembly_reference)
|
||||
|
||||
12
external/cecil/Mono.Cecil/MetadataResolver.cs
vendored
12
external/cecil/Mono.Cecil/MetadataResolver.cs
vendored
@@ -17,9 +17,6 @@ namespace Mono.Cecil {
|
||||
public interface IAssemblyResolver : IDisposable {
|
||||
AssemblyDefinition Resolve (AssemblyNameReference name);
|
||||
AssemblyDefinition Resolve (AssemblyNameReference name, ReaderParameters parameters);
|
||||
|
||||
AssemblyDefinition Resolve (string fullName);
|
||||
AssemblyDefinition Resolve (string fullName, ReaderParameters parameters);
|
||||
}
|
||||
|
||||
public interface IMetadataResolver {
|
||||
@@ -90,8 +87,7 @@ namespace Mono.Cecil {
|
||||
|
||||
public virtual TypeDefinition Resolve (TypeReference type)
|
||||
{
|
||||
if (type == null)
|
||||
throw new ArgumentNullException ("type");
|
||||
Mixin.CheckType (type);
|
||||
|
||||
type = type.GetElementType ();
|
||||
|
||||
@@ -162,8 +158,7 @@ namespace Mono.Cecil {
|
||||
|
||||
public virtual FieldDefinition Resolve (FieldReference field)
|
||||
{
|
||||
if (field == null)
|
||||
throw new ArgumentNullException ("field");
|
||||
Mixin.CheckField (field);
|
||||
|
||||
var type = Resolve (field.DeclaringType);
|
||||
if (type == null)
|
||||
@@ -210,8 +205,7 @@ namespace Mono.Cecil {
|
||||
|
||||
public virtual MethodDefinition Resolve (MethodReference method)
|
||||
{
|
||||
if (method == null)
|
||||
throw new ArgumentNullException ("method");
|
||||
Mixin.CheckMethod (method);
|
||||
|
||||
var type = Resolve (method.DeclaringType);
|
||||
if (type == null)
|
||||
|
||||
6
external/cecil/Mono.Cecil/MethodReference.cs
vendored
6
external/cecil/Mono.Cecil/MethodReference.cs
vendored
@@ -144,8 +144,7 @@ namespace Mono.Cecil {
|
||||
public MethodReference (string name, TypeReference returnType)
|
||||
: base (name)
|
||||
{
|
||||
if (returnType == null)
|
||||
throw new ArgumentNullException ("returnType");
|
||||
Mixin.CheckType (returnType, Mixin.Argument.returnType);
|
||||
|
||||
this.return_type = new MethodReturnType (this);
|
||||
this.return_type.ReturnType = returnType;
|
||||
@@ -155,8 +154,7 @@ namespace Mono.Cecil {
|
||||
public MethodReference (string name, TypeReference returnType, TypeReference declaringType)
|
||||
: this (name, returnType)
|
||||
{
|
||||
if (declaringType == null)
|
||||
throw new ArgumentNullException ("declaringType");
|
||||
Mixin.CheckType (declaringType, Mixin.Argument.declaringType);
|
||||
|
||||
this.DeclaringType = declaringType;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,7 @@ namespace Mono.Cecil {
|
||||
|
||||
internal MethodSpecification (MethodReference method)
|
||||
{
|
||||
if (method == null)
|
||||
throw new ArgumentNullException ("method");
|
||||
Mixin.CheckMethod (method);
|
||||
|
||||
this.method = method;
|
||||
this.token = new MetadataToken (TokenType.MethodSpec);
|
||||
|
||||
19
external/cecil/Mono.Cecil/Modifiers.cs
vendored
19
external/cecil/Mono.Cecil/Modifiers.cs
vendored
@@ -56,7 +56,9 @@ namespace Mono.Cecil {
|
||||
public OptionalModifierType (TypeReference modifierType, TypeReference type)
|
||||
: base (type)
|
||||
{
|
||||
Mixin.CheckModifier (modifierType, type);
|
||||
if (modifierType == null)
|
||||
throw new ArgumentNullException (Mixin.Argument.modifierType.ToString ());
|
||||
Mixin.CheckType (type);
|
||||
this.modifier_type = modifierType;
|
||||
this.etype = MD.ElementType.CModOpt;
|
||||
}
|
||||
@@ -99,21 +101,12 @@ namespace Mono.Cecil {
|
||||
public RequiredModifierType (TypeReference modifierType, TypeReference type)
|
||||
: base (type)
|
||||
{
|
||||
Mixin.CheckModifier (modifierType, type);
|
||||
if (modifierType == null)
|
||||
throw new ArgumentNullException (Mixin.Argument.modifierType.ToString ());
|
||||
Mixin.CheckType (type);
|
||||
this.modifier_type = modifierType;
|
||||
this.etype = MD.ElementType.CModReqD;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static partial class Mixin {
|
||||
|
||||
public static void CheckModifier (TypeReference modifierType, TypeReference type)
|
||||
{
|
||||
if (modifierType == null)
|
||||
throw new ArgumentNullException ("modifierType");
|
||||
if (type == null)
|
||||
throw new ArgumentNullException ("type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
97
external/cecil/Mono.Cecil/ModuleDefinition.cs
vendored
97
external/cecil/Mono.Cecil/ModuleDefinition.cs
vendored
@@ -88,10 +88,12 @@ namespace Mono.Cecil {
|
||||
set { symbol_reader_provider = value; }
|
||||
}
|
||||
|
||||
#if !PCL
|
||||
public bool ReadSymbols {
|
||||
get { return read_symbols; }
|
||||
set { read_symbols = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public bool ReadWrite {
|
||||
get { return read_write; }
|
||||
@@ -234,10 +236,13 @@ namespace Mono.Cecil {
|
||||
set { symbol_writer_provider = value; }
|
||||
}
|
||||
|
||||
#if !PCL
|
||||
public bool WriteSymbols {
|
||||
get { return write_symbols; }
|
||||
set { write_symbols = value; }
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !PCL && !NET_CORE
|
||||
public SR.StrongNameKeyPair StrongNameKeyPair {
|
||||
get { return key_pair; }
|
||||
@@ -271,6 +276,7 @@ namespace Mono.Cecil {
|
||||
ModuleAttributes attributes;
|
||||
ModuleCharacteristics characteristics;
|
||||
Guid mvid;
|
||||
internal uint timestamp;
|
||||
|
||||
internal AssemblyDefinition assembly;
|
||||
MethodDefinition entry_point;
|
||||
@@ -592,6 +598,7 @@ namespace Mono.Cecil {
|
||||
this.attributes = image.Attributes;
|
||||
this.characteristics = image.Characteristics;
|
||||
this.file_name = image.FileName;
|
||||
this.timestamp = image.TimeStamp;
|
||||
|
||||
this.reader = new MetadataReader (this);
|
||||
}
|
||||
@@ -615,7 +622,7 @@ namespace Mono.Cecil {
|
||||
|
||||
public bool HasTypeReference (string scope, string fullName)
|
||||
{
|
||||
CheckFullName (fullName);
|
||||
Mixin.CheckFullName (fullName);
|
||||
|
||||
if (!HasImage)
|
||||
return false;
|
||||
@@ -630,7 +637,7 @@ namespace Mono.Cecil {
|
||||
|
||||
public bool TryGetTypeReference (string scope, string fullName, out TypeReference type)
|
||||
{
|
||||
CheckFullName (fullName);
|
||||
Mixin.CheckFullName (fullName);
|
||||
|
||||
if (!HasImage) {
|
||||
type = null;
|
||||
@@ -678,7 +685,7 @@ namespace Mono.Cecil {
|
||||
|
||||
public TypeDefinition GetType (string fullName)
|
||||
{
|
||||
CheckFullName (fullName);
|
||||
Mixin.CheckFullName (fullName);
|
||||
|
||||
var position = fullName.IndexOf ('/');
|
||||
if (position > 0)
|
||||
@@ -714,14 +721,6 @@ namespace Mono.Cecil {
|
||||
}
|
||||
}
|
||||
|
||||
static void CheckFullName (string fullName)
|
||||
{
|
||||
if (fullName == null)
|
||||
throw new ArgumentNullException ("fullName");
|
||||
if (fullName.Length == 0)
|
||||
throw new ArgumentException ();
|
||||
}
|
||||
|
||||
TypeDefinition GetNestedType (string fullname)
|
||||
{
|
||||
var names = fullname.Split ('/');
|
||||
@@ -1017,11 +1016,15 @@ namespace Mono.Cecil {
|
||||
if (!HasDebugHeader)
|
||||
return;
|
||||
|
||||
byte [] header;
|
||||
var directory = GetDebugHeader (out header);
|
||||
try {
|
||||
byte [] header;
|
||||
var directory = GetDebugHeader (out header);
|
||||
|
||||
if (!symbol_reader.ProcessDebugHeader (directory, header))
|
||||
throw new InvalidOperationException ();
|
||||
if (!symbol_reader.ProcessDebugHeader (directory, header))
|
||||
throw new InvalidOperationException ();
|
||||
} finally {
|
||||
symbol_reader = null;
|
||||
}
|
||||
}
|
||||
|
||||
#if !READ_ONLY
|
||||
@@ -1089,10 +1092,7 @@ namespace Mono.Cecil {
|
||||
if (string.IsNullOrEmpty (file_name))
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
var provider = SymbolProvider.GetPlatformReaderProvider ();
|
||||
if (provider == null)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
var provider = new DefaultSymbolReaderProvider (throwIfNoSymbol: true);
|
||||
ReadSymbols (provider.GetSymbolReader (this, file_name));
|
||||
}
|
||||
#endif
|
||||
@@ -1220,18 +1220,53 @@ namespace Mono.Cecil {
|
||||
|
||||
static partial class Mixin {
|
||||
|
||||
public enum Argument {
|
||||
name,
|
||||
fileName,
|
||||
fullName,
|
||||
stream,
|
||||
type,
|
||||
method,
|
||||
field,
|
||||
parameters,
|
||||
module,
|
||||
modifierType,
|
||||
eventType,
|
||||
fieldType,
|
||||
declaringType,
|
||||
returnType,
|
||||
propertyType,
|
||||
interfaceType,
|
||||
}
|
||||
|
||||
public static void CheckName (object name)
|
||||
{
|
||||
if (name == null)
|
||||
throw new ArgumentNullException (Argument.name.ToString ());
|
||||
}
|
||||
|
||||
public static void CheckName (string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty (name))
|
||||
throw new ArgumentNullOrEmptyException (Argument.name.ToString ());
|
||||
}
|
||||
|
||||
public static void CheckFileName (string fileName)
|
||||
{
|
||||
if (fileName == null)
|
||||
throw new ArgumentNullException ("fileName");
|
||||
if (fileName.Length == 0)
|
||||
throw new ArgumentException ();
|
||||
if (string.IsNullOrEmpty (fileName))
|
||||
throw new ArgumentNullOrEmptyException (Argument.fileName.ToString ());
|
||||
}
|
||||
|
||||
public static void CheckFullName (string fullName)
|
||||
{
|
||||
if (string.IsNullOrEmpty (fullName))
|
||||
throw new ArgumentNullOrEmptyException (Argument.fullName.ToString ());
|
||||
}
|
||||
|
||||
public static void CheckStream (object stream)
|
||||
{
|
||||
if (stream == null)
|
||||
throw new ArgumentNullException ("stream");
|
||||
throw new ArgumentNullException (Argument.stream.ToString ());
|
||||
}
|
||||
|
||||
public static void CheckWriteSeek (Stream stream)
|
||||
@@ -1251,19 +1286,25 @@ namespace Mono.Cecil {
|
||||
public static void CheckType (object type)
|
||||
{
|
||||
if (type == null)
|
||||
throw new ArgumentNullException ("type");
|
||||
throw new ArgumentNullException (Argument.type.ToString ());
|
||||
}
|
||||
|
||||
public static void CheckType (object type, Argument argument)
|
||||
{
|
||||
if (type == null)
|
||||
throw new ArgumentNullException (argument.ToString ());
|
||||
}
|
||||
|
||||
public static void CheckField (object field)
|
||||
{
|
||||
if (field == null)
|
||||
throw new ArgumentNullException ("field");
|
||||
throw new ArgumentNullException (Argument.field.ToString ());
|
||||
}
|
||||
|
||||
public static void CheckMethod (object method)
|
||||
{
|
||||
if (method == null)
|
||||
throw new ArgumentNullException ("method");
|
||||
throw new ArgumentNullException (Argument.method.ToString ());
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1271,7 +1312,7 @@ namespace Mono.Cecil {
|
||||
public static void CheckParameters (object parameters)
|
||||
{
|
||||
if (parameters == null)
|
||||
throw new ArgumentNullException ("parameters");
|
||||
throw new ArgumentNullException (Argument.parameters.ToString ());
|
||||
}
|
||||
|
||||
public static bool HasImage (this ModuleDefinition self)
|
||||
|
||||
@@ -30,8 +30,7 @@ namespace Mono.Cecil {
|
||||
internal PropertyReference (string name, TypeReference propertyType)
|
||||
: base (name)
|
||||
{
|
||||
if (propertyType == null)
|
||||
throw new ArgumentNullException ("propertyType");
|
||||
Mixin.CheckType (propertyType, Mixin.Argument.propertyType);
|
||||
|
||||
property_type = propertyType;
|
||||
}
|
||||
|
||||
3
external/cecil/Mono.Cecil/TypeDefinition.cs
vendored
3
external/cecil/Mono.Cecil/TypeDefinition.cs
vendored
@@ -528,8 +528,7 @@ namespace Mono.Cecil {
|
||||
|
||||
public InterfaceImplementation (TypeReference interfaceType)
|
||||
{
|
||||
if (interfaceType == null)
|
||||
throw new ArgumentNullException ("interfaceType");
|
||||
Mixin.CheckType (interfaceType, Mixin.Argument.interfaceType);
|
||||
|
||||
this.interface_type = interfaceType;
|
||||
this.token = new MetadataToken (TokenType.InterfaceImpl);
|
||||
|
||||
@@ -65,13 +65,4 @@ namespace Mono.Cecil {
|
||||
return element_type.GetElementType ();
|
||||
}
|
||||
}
|
||||
|
||||
static partial class Mixin {
|
||||
|
||||
public static void CheckType (TypeReference type)
|
||||
{
|
||||
if (type == null)
|
||||
throw new ArgumentNullException ("type");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user