You've already forked linux-packaging-mono
Imported Upstream version 5.4.0.199
Former-commit-id: f4d318e4b2f128fa9f4d31b37bb3839a3fc0dfb2
This commit is contained in:
parent
536cd135cc
commit
5924117973
@@ -11,6 +11,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
|
||||
using Mono.Collections.Generic;
|
||||
@@ -2856,12 +2857,22 @@ namespace Mono.Cecil {
|
||||
if (signature == 0)
|
||||
return new Collection<SequencePoint> (0);
|
||||
|
||||
var document = metadata.GetDocument (document_index);
|
||||
var document = GetDocument (document_index);
|
||||
var reader = ReadSignature (signature);
|
||||
|
||||
return reader.ReadSequencePoints (document);
|
||||
}
|
||||
|
||||
public Document GetDocument (uint rid)
|
||||
{
|
||||
var document = metadata.GetDocument (rid);
|
||||
if (document == null)
|
||||
return null;
|
||||
|
||||
document.custom_infos = GetCustomDebugInformation (document);
|
||||
return document;
|
||||
}
|
||||
|
||||
void InitializeLocalScopes ()
|
||||
{
|
||||
if (metadata.LocalScopes != null)
|
||||
@@ -2943,14 +2954,20 @@ namespace Mono.Cecil {
|
||||
|
||||
if (record.Col2.Length > 0) {
|
||||
scope.variables = new Collection<VariableDebugInformation> ((int) record.Col2.Length);
|
||||
for (uint i = 0; i < record.Col2.Length; i++)
|
||||
scope.variables.Add (ReadLocalVariable (record.Col2.Start + i));
|
||||
for (uint i = 0; i < record.Col2.Length; i++) {
|
||||
var variable = ReadLocalVariable (record.Col2.Start + i);
|
||||
if (variable != null)
|
||||
scope.variables.Add (variable);
|
||||
}
|
||||
}
|
||||
|
||||
if (record.Col3.Length > 0) {
|
||||
scope.constants = new Collection<ConstantDebugInformation> ((int) record.Col3.Length);
|
||||
for (uint i = 0; i < record.Col3.Length; i++)
|
||||
scope.constants.Add (ReadLocalConstant (record.Col3.Start + i));
|
||||
for (uint i = 0; i < record.Col3.Length; i++) {
|
||||
var constant = ReadLocalConstant (record.Col3.Start + i);
|
||||
if (constant != null)
|
||||
scope.constants.Add (constant);
|
||||
}
|
||||
}
|
||||
|
||||
return scope;
|
||||
@@ -3187,6 +3204,31 @@ namespace Mono.Cecil {
|
||||
async_body.move_next = GetMethodDefinition (move_next_rid);
|
||||
|
||||
infos.Add (async_body);
|
||||
} else if (rows [i].Col1 == EmbeddedSourceDebugInformation.KindIdentifier) {
|
||||
var signature = ReadSignature (rows [i].Col2);
|
||||
var format = signature.ReadInt32 ();
|
||||
var length = signature.sig_length - 4;
|
||||
|
||||
var info = null as CustomDebugInformation;
|
||||
|
||||
if (format == 0) {
|
||||
info = new EmbeddedSourceDebugInformation (signature.ReadBytes ((int) length), compress: false);
|
||||
} else if (format > 0) {
|
||||
var compressed_stream = new MemoryStream (signature.ReadBytes ((int) length));
|
||||
var decompressed_document = new byte [format]; // if positive, format is the decompressed length of the document
|
||||
var decompressed_stream = new MemoryStream (decompressed_document);
|
||||
|
||||
using (var deflate_stream = new DeflateStream (compressed_stream, CompressionMode.Decompress, leaveOpen: true))
|
||||
deflate_stream.CopyTo (decompressed_stream);
|
||||
|
||||
info = new EmbeddedSourceDebugInformation (decompressed_document, compress: true);
|
||||
} else if (format < 0) {
|
||||
info = new BinaryCustomDebugInformation (rows [i].Col1, ReadBlob (rows [i].Col2));
|
||||
}
|
||||
|
||||
infos.Add (info);
|
||||
} else if (rows [i].Col1 == SourceLinkDebugInformation.KindIdentifier) {
|
||||
infos.Add (new SourceLinkDebugInformation (Encoding.UTF8.GetString (ReadBlob (rows [i].Col2))));
|
||||
} else {
|
||||
infos.Add (new BinaryCustomDebugInformation (rows [i].Col1, ReadBlob (rows [i].Col2)));
|
||||
}
|
||||
@@ -3759,7 +3801,7 @@ namespace Mono.Cecil {
|
||||
ReadCompressedUInt32 (); // local_sig_token
|
||||
|
||||
if (document == null)
|
||||
document = reader.metadata.GetDocument (ReadCompressedUInt32 ());
|
||||
document = reader.GetDocument (ReadCompressedUInt32 ());
|
||||
|
||||
var offset = 0;
|
||||
var start_line = 0;
|
||||
@@ -3769,7 +3811,7 @@ namespace Mono.Cecil {
|
||||
for (var i = 0; CanReadMore (); i++) {
|
||||
var delta_il = (int) ReadCompressedUInt32 ();
|
||||
if (i > 0 && delta_il == 0) {
|
||||
document = reader.metadata.GetDocument (ReadCompressedUInt32 ());
|
||||
document = reader.GetDocument (ReadCompressedUInt32 ());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
|
||||
using Mono;
|
||||
@@ -72,7 +73,13 @@ namespace Mono.Cecil {
|
||||
|
||||
static class ModuleWriter {
|
||||
|
||||
public static void WriteModuleTo (ModuleDefinition module, Disposable<Stream> stream, WriterParameters parameters)
|
||||
public static void WriteModule (ModuleDefinition module, Disposable<Stream> stream, WriterParameters parameters)
|
||||
{
|
||||
using (stream)
|
||||
Write (module, stream, parameters);
|
||||
}
|
||||
|
||||
static void Write (ModuleDefinition module, Disposable<Stream> stream, WriterParameters parameters)
|
||||
{
|
||||
if ((module.Attributes & ModuleAttributes.ILOnly) == 0)
|
||||
throw new NotSupportedException ("Writing mixed-mode assemblies is not supported");
|
||||
@@ -90,13 +97,12 @@ namespace Mono.Cecil {
|
||||
|
||||
var name = module.assembly != null ? module.assembly.Name : null;
|
||||
var fq_name = stream.value.GetFileName ();
|
||||
var timestamp = parameters.Timestamp ?? module.timestamp;
|
||||
var symbol_writer_provider = parameters.SymbolWriterProvider;
|
||||
|
||||
if (symbol_writer_provider == null && parameters.WriteSymbols)
|
||||
symbol_writer_provider = new DefaultSymbolWriterProvider ();
|
||||
|
||||
var symbol_writer = GetSymbolWriter (module, fq_name, symbol_writer_provider, parameters);
|
||||
|
||||
#if !NET_CORE
|
||||
if (parameters.StrongNameKeyPair != null && name != null) {
|
||||
name.PublicKey = parameters.StrongNameKeyPair.PublicKey;
|
||||
@@ -104,26 +110,19 @@ namespace Mono.Cecil {
|
||||
}
|
||||
#endif
|
||||
|
||||
var timestamp = parameters.Timestamp ?? module.timestamp;
|
||||
using (var symbol_writer = GetSymbolWriter (module, fq_name, symbol_writer_provider, parameters)) {
|
||||
var metadata = new MetadataBuilder (module, fq_name, timestamp, symbol_writer_provider, symbol_writer);
|
||||
BuildMetadata (module, metadata);
|
||||
|
||||
var metadata = new MetadataBuilder (module, fq_name, timestamp, symbol_writer_provider, symbol_writer);
|
||||
|
||||
BuildMetadata (module, metadata);
|
||||
|
||||
var writer = ImageWriter.CreateWriter (module, metadata, stream);
|
||||
|
||||
stream.value.SetLength (0);
|
||||
|
||||
writer.WriteImage ();
|
||||
|
||||
if (metadata.symbol_writer != null)
|
||||
metadata.symbol_writer.Dispose ();
|
||||
var writer = ImageWriter.CreateWriter (module, metadata, stream);
|
||||
stream.value.SetLength (0);
|
||||
writer.WriteImage ();
|
||||
|
||||
#if !NET_CORE
|
||||
if (parameters.StrongNameKeyPair != null)
|
||||
CryptoService.StrongName (stream.value, writer, parameters.StrongNameKeyPair);
|
||||
if (parameters.StrongNameKeyPair != null)
|
||||
CryptoService.StrongName (stream.value, writer, parameters.StrongNameKeyPair);
|
||||
#endif
|
||||
stream.Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
static void BuildMetadata (ModuleDefinition module, MetadataBuilder metadata)
|
||||
@@ -776,7 +775,7 @@ namespace Mono.Cecil {
|
||||
}
|
||||
}
|
||||
|
||||
sealed class CustomDebugInformationTable : MetadataTable<CustomDebugInformationRow> {
|
||||
sealed class CustomDebugInformationTable : SortedTable<CustomDebugInformationRow> {
|
||||
|
||||
public override void Write (TableHeapBuffer buffer)
|
||||
{
|
||||
@@ -786,6 +785,11 @@ namespace Mono.Cecil {
|
||||
buffer.WriteBlob (rows [i].Col3); // Value
|
||||
}
|
||||
}
|
||||
|
||||
public override int Compare (CustomDebugInformationRow x, CustomDebugInformationRow y)
|
||||
{
|
||||
return Compare(x.Col1, y.Col1);
|
||||
}
|
||||
}
|
||||
|
||||
sealed class MetadataBuilder {
|
||||
@@ -1046,6 +1050,10 @@ namespace Mono.Cecil {
|
||||
|
||||
if (module.EntryPoint != null)
|
||||
entry_point = LookupToken (module.EntryPoint);
|
||||
|
||||
var pdb_writer = symbol_writer as IMetadataSymbolWriter;
|
||||
if (pdb_writer != null)
|
||||
pdb_writer.WriteModule ();
|
||||
}
|
||||
|
||||
void BuildAssembly ()
|
||||
@@ -2347,7 +2355,7 @@ namespace Mono.Cecil {
|
||||
return signature;
|
||||
}
|
||||
|
||||
void AddCustomDebugInformations (ICustomDebugInformationProvider provider)
|
||||
public void AddCustomDebugInformations (ICustomDebugInformationProvider provider)
|
||||
{
|
||||
if (!provider.HasCustomDebugInformations)
|
||||
return;
|
||||
@@ -2367,6 +2375,12 @@ namespace Mono.Cecil {
|
||||
case CustomDebugInformationKind.StateMachineScope:
|
||||
AddStateMachineScopeDebugInformation (provider, (StateMachineScopeDebugInformation) custom_info);
|
||||
break;
|
||||
case CustomDebugInformationKind.EmbeddedSource:
|
||||
AddEmbeddedSourceDebugInformation (provider, (EmbeddedSourceDebugInformation) custom_info);
|
||||
break;
|
||||
case CustomDebugInformationKind.SourceLink:
|
||||
AddSourceLinkDebugInformation (provider, (SourceLinkDebugInformation) custom_info);
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
@@ -2403,6 +2417,36 @@ namespace Mono.Cecil {
|
||||
AddCustomDebugInformation (provider, async_method, signature);
|
||||
}
|
||||
|
||||
void AddEmbeddedSourceDebugInformation (ICustomDebugInformationProvider provider, EmbeddedSourceDebugInformation embedded_source)
|
||||
{
|
||||
var signature = CreateSignatureWriter ();
|
||||
var content = embedded_source.content ?? Empty<byte>.Array;
|
||||
if (embedded_source.compress) {
|
||||
signature.WriteInt32 (content.Length);
|
||||
|
||||
var decompressed_stream = new MemoryStream (content);
|
||||
var content_stream = new MemoryStream ();
|
||||
|
||||
using (var compress_stream = new DeflateStream (content_stream, CompressionMode.Compress, leaveOpen: true))
|
||||
decompressed_stream.CopyTo (compress_stream);
|
||||
|
||||
signature.WriteBytes (content_stream.ToArray ());
|
||||
} else {
|
||||
signature.WriteInt32 (0);
|
||||
signature.WriteBytes (content);
|
||||
}
|
||||
|
||||
AddCustomDebugInformation (provider, embedded_source, signature);
|
||||
}
|
||||
|
||||
void AddSourceLinkDebugInformation (ICustomDebugInformationProvider provider, SourceLinkDebugInformation source_link)
|
||||
{
|
||||
var signature = CreateSignatureWriter ();
|
||||
signature.WriteBytes (Encoding.UTF8.GetBytes (source_link.content));
|
||||
|
||||
AddCustomDebugInformation (provider, source_link, signature);
|
||||
}
|
||||
|
||||
void AddCustomDebugInformation (ICustomDebugInformationProvider provider, CustomDebugInformation custom_info, SignatureWriter signature)
|
||||
{
|
||||
AddCustomDebugInformation (provider, custom_info, GetBlobIndex (signature));
|
||||
@@ -2507,6 +2551,8 @@ namespace Mono.Cecil {
|
||||
|
||||
document.token = token;
|
||||
|
||||
AddCustomDebugInformations (document);
|
||||
|
||||
document_map.Add (document.Url, token);
|
||||
|
||||
return token;
|
||||
|
||||
@@ -45,7 +45,12 @@ namespace Mono.Cecil {
|
||||
}
|
||||
|
||||
public AssemblyResolutionException (AssemblyNameReference reference)
|
||||
: base (string.Format ("Failed to resolve assembly: '{0}'", reference))
|
||||
: this (reference, null)
|
||||
{
|
||||
}
|
||||
|
||||
public AssemblyResolutionException (AssemblyNameReference reference, Exception innerException)
|
||||
: base (string.Format ("Failed to resolve assembly: '{0}'", reference), innerException)
|
||||
{
|
||||
this.reference = reference;
|
||||
}
|
||||
@@ -123,9 +128,12 @@ namespace Mono.Cecil {
|
||||
}
|
||||
|
||||
var framework_dir = Path.GetDirectoryName (typeof (object).Module.FullyQualifiedName);
|
||||
var framework_dirs = on_mono
|
||||
? new [] { framework_dir, Path.Combine (framework_dir, "Facades") }
|
||||
: new [] { framework_dir };
|
||||
|
||||
if (IsZero (name.Version)) {
|
||||
assembly = SearchDirectory (name, new [] { framework_dir }, parameters);
|
||||
assembly = SearchDirectory (name, framework_dirs, parameters);
|
||||
if (assembly != null)
|
||||
return assembly;
|
||||
}
|
||||
@@ -140,7 +148,7 @@ namespace Mono.Cecil {
|
||||
if (assembly != null)
|
||||
return assembly;
|
||||
|
||||
assembly = SearchDirectory (name, new [] { framework_dir }, parameters);
|
||||
assembly = SearchDirectory (name, framework_dirs, parameters);
|
||||
if (assembly != null)
|
||||
return assembly;
|
||||
|
||||
|
||||
41
external/linker/cecil/Mono.Cecil/Import.cs
vendored
41
external/linker/cecil/Mono.Cecil/Import.cs
vendored
@@ -24,6 +24,7 @@ namespace Mono.Cecil {
|
||||
}
|
||||
|
||||
public interface IMetadataImporter {
|
||||
AssemblyNameReference ImportReference (AssemblyNameReference reference);
|
||||
TypeReference ImportReference (TypeReference type, IGenericParameterProvider context);
|
||||
FieldReference ImportReference (FieldReference field, IGenericParameterProvider context);
|
||||
MethodReference ImportReference (MethodReference method, IGenericParameterProvider context);
|
||||
@@ -34,6 +35,7 @@ namespace Mono.Cecil {
|
||||
}
|
||||
|
||||
public interface IReflectionImporter {
|
||||
AssemblyNameReference ImportReference (SR.AssemblyName reference);
|
||||
TypeReference ImportReference (Type type, IGenericParameterProvider context);
|
||||
FieldReference ImportReference (SR.FieldInfo field, IGenericParameterProvider context);
|
||||
MethodReference ImportReference (SR.MethodBase method, IGenericParameterProvider context);
|
||||
@@ -122,11 +124,11 @@ namespace Mono.Cecil {
|
||||
}
|
||||
}
|
||||
|
||||
public class ReflectionImporter : IReflectionImporter {
|
||||
public class DefaultReflectionImporter : IReflectionImporter {
|
||||
|
||||
readonly ModuleDefinition module;
|
||||
readonly protected ModuleDefinition module;
|
||||
|
||||
public ReflectionImporter (ModuleDefinition module)
|
||||
public DefaultReflectionImporter (ModuleDefinition module)
|
||||
{
|
||||
Mixin.CheckModule (module);
|
||||
|
||||
@@ -294,14 +296,19 @@ namespace Mono.Cecil {
|
||||
|
||||
AssemblyNameReference ImportScope (SR.Assembly assembly)
|
||||
{
|
||||
AssemblyNameReference scope;
|
||||
return ImportReference (assembly.GetName ());
|
||||
}
|
||||
|
||||
var name = assembly.GetName ();
|
||||
public virtual AssemblyNameReference ImportReference (SR.AssemblyName name)
|
||||
{
|
||||
Mixin.CheckName (name);
|
||||
|
||||
if (TryGetAssemblyNameReference (name, out scope))
|
||||
return scope;
|
||||
AssemblyNameReference reference;
|
||||
if (TryGetAssemblyNameReference (name, out reference))
|
||||
return reference;
|
||||
|
||||
scope = new AssemblyNameReference (name.Name, name.Version) {
|
||||
reference = new AssemblyNameReference (name.Name, name.Version)
|
||||
{
|
||||
PublicKeyToken = name.GetPublicKeyToken (),
|
||||
#if !NET_CORE
|
||||
Culture = name.CultureInfo.Name,
|
||||
@@ -309,9 +316,9 @@ namespace Mono.Cecil {
|
||||
#endif
|
||||
};
|
||||
|
||||
module.AssemblyReferences.Add (scope);
|
||||
module.AssemblyReferences.Add (reference);
|
||||
|
||||
return scope;
|
||||
return reference;
|
||||
}
|
||||
|
||||
bool TryGetAssemblyNameReference (SR.AssemblyName name, out AssemblyNameReference assembly_reference)
|
||||
@@ -477,11 +484,11 @@ namespace Mono.Cecil {
|
||||
}
|
||||
}
|
||||
|
||||
public class MetadataImporter : IMetadataImporter {
|
||||
public class DefaultMetadataImporter : IMetadataImporter {
|
||||
|
||||
readonly ModuleDefinition module;
|
||||
readonly protected ModuleDefinition module;
|
||||
|
||||
public MetadataImporter (ModuleDefinition module)
|
||||
public DefaultMetadataImporter (ModuleDefinition module)
|
||||
{
|
||||
Mixin.CheckModule (module);
|
||||
|
||||
@@ -515,10 +522,10 @@ namespace Mono.Cecil {
|
||||
{
|
||||
switch (scope.MetadataScopeType) {
|
||||
case MetadataScopeType.AssemblyNameReference:
|
||||
return ImportAssemblyName ((AssemblyNameReference) scope);
|
||||
return ImportReference ((AssemblyNameReference) scope);
|
||||
case MetadataScopeType.ModuleDefinition:
|
||||
if (scope == module) return scope;
|
||||
return ImportAssemblyName (((ModuleDefinition) scope).Assembly.Name);
|
||||
return ImportReference (((ModuleDefinition) scope).Assembly.Name);
|
||||
case MetadataScopeType.ModuleReference:
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
@@ -526,8 +533,10 @@ namespace Mono.Cecil {
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
|
||||
internal virtual AssemblyNameReference ImportAssemblyName (AssemblyNameReference name)
|
||||
public virtual AssemblyNameReference ImportReference (AssemblyNameReference name)
|
||||
{
|
||||
Mixin.CheckName (name);
|
||||
|
||||
AssemblyNameReference reference;
|
||||
if (module.TryGetAssemblyNameReference (name, out reference))
|
||||
return reference;
|
||||
|
||||
@@ -171,11 +171,11 @@ namespace Mono.Cecil {
|
||||
|
||||
public MethodDebugInformation DebugInformation {
|
||||
get {
|
||||
Mixin.Read (Body);
|
||||
|
||||
if (debug_info != null)
|
||||
return debug_info;
|
||||
|
||||
Mixin.Read (Body);
|
||||
|
||||
return debug_info ?? (debug_info = new MethodDebugInformation (this));
|
||||
}
|
||||
}
|
||||
@@ -416,6 +416,11 @@ namespace Mono.Cecil {
|
||||
set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.NoOptimization, value); }
|
||||
}
|
||||
|
||||
public bool AggressiveInlining {
|
||||
get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.AggressiveInlining); }
|
||||
set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.AggressiveInlining, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MethodSemanticsAttributes
|
||||
|
||||
@@ -31,5 +31,6 @@ namespace Mono.Cecil {
|
||||
Synchronized = 0x0020, // Method is single threaded through the body
|
||||
NoOptimization = 0x0040, // Method is not optimized by the JIT.
|
||||
NoInlining = 0x0008, // Method may not be inlined
|
||||
AggressiveInlining = 0x0100, // Method should be inlined, if possible.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace Mono.Cecil {
|
||||
|
||||
#endif
|
||||
|
||||
public sealed class ModuleDefinition : ModuleReference, ICustomAttributeProvider, IDisposable {
|
||||
public sealed class ModuleDefinition : ModuleReference, ICustomAttributeProvider, ICustomDebugInformationProvider, IDisposable {
|
||||
|
||||
internal Image Image;
|
||||
internal MetadataSystem MetadataSystem;
|
||||
@@ -294,6 +294,8 @@ namespace Mono.Cecil {
|
||||
Collection<ExportedType> exported_types;
|
||||
TypeDefinitionCollection types;
|
||||
|
||||
internal Collection<CustomDebugInformation> custom_infos;
|
||||
|
||||
public bool IsMain {
|
||||
get { return kind != ModuleKind.NetModule; }
|
||||
}
|
||||
@@ -386,7 +388,7 @@ namespace Mono.Cecil {
|
||||
internal IReflectionImporter ReflectionImporter {
|
||||
get {
|
||||
if (reflection_importer == null)
|
||||
Interlocked.CompareExchange (ref reflection_importer, new ReflectionImporter (this), null);
|
||||
Interlocked.CompareExchange (ref reflection_importer, new DefaultReflectionImporter (this), null);
|
||||
|
||||
return reflection_importer;
|
||||
}
|
||||
@@ -395,13 +397,13 @@ namespace Mono.Cecil {
|
||||
internal IMetadataImporter MetadataImporter {
|
||||
get {
|
||||
if (metadata_importer == null)
|
||||
Interlocked.CompareExchange (ref metadata_importer, new MetadataImporter (this), null);
|
||||
Interlocked.CompareExchange (ref metadata_importer, new DefaultMetadataImporter (this), null);
|
||||
|
||||
return metadata_importer;
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetMetadataImporter (MetadataImporter importer)
|
||||
internal void SetMetadataImporter (IMetadataImporter importer)
|
||||
{
|
||||
if (this.metadata_importer != null)
|
||||
throw new InvalidOperationException ();
|
||||
@@ -580,6 +582,18 @@ namespace Mono.Cecil {
|
||||
set { entry_point = value; }
|
||||
}
|
||||
|
||||
public bool HasCustomDebugInformations {
|
||||
get {
|
||||
return custom_infos != null && custom_infos.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<CustomDebugInformation> CustomDebugInformations {
|
||||
get {
|
||||
return custom_infos ?? (custom_infos = new Collection<CustomDebugInformation> ());
|
||||
}
|
||||
}
|
||||
|
||||
internal ModuleDefinition ()
|
||||
{
|
||||
this.MetadataSystem = new MetadataSystem ();
|
||||
@@ -1149,7 +1163,7 @@ namespace Mono.Cecil {
|
||||
{
|
||||
Mixin.CheckParameters (parameters);
|
||||
var file = GetFileStream (fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.Read);
|
||||
ModuleWriter.WriteModuleTo (this, Disposable.Owned (file), parameters);
|
||||
ModuleWriter.WriteModule (this, Disposable.Owned (file), parameters);
|
||||
}
|
||||
|
||||
public void Write ()
|
||||
@@ -1176,7 +1190,7 @@ namespace Mono.Cecil {
|
||||
Mixin.CheckWriteSeek (stream);
|
||||
Mixin.CheckParameters (parameters);
|
||||
|
||||
ModuleWriter.WriteModuleTo (this, Disposable.NotOwned (stream), parameters);
|
||||
ModuleWriter.WriteModule (this, Disposable.NotOwned (stream), parameters);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1237,17 +1251,15 @@ namespace Mono.Cecil {
|
||||
public static void CheckWriteSeek (Stream stream)
|
||||
{
|
||||
if (!stream.CanWrite || !stream.CanSeek)
|
||||
throw new ArgumentException ();
|
||||
throw new ArgumentException ("Stream must be writable and seekable.");
|
||||
}
|
||||
|
||||
public static void CheckReadSeek (Stream stream)
|
||||
{
|
||||
if (!stream.CanRead || !stream.CanSeek)
|
||||
throw new ArgumentException ();
|
||||
throw new ArgumentException ("Stream must be readable and seekable.");
|
||||
}
|
||||
|
||||
#if !READ_ONLY
|
||||
|
||||
public static void CheckType (object type)
|
||||
{
|
||||
if (type == null)
|
||||
@@ -1272,8 +1284,6 @@ namespace Mono.Cecil {
|
||||
throw new ArgumentNullException (Argument.method.ToString ());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
public static void CheckParameters (object parameters)
|
||||
{
|
||||
if (parameters == null)
|
||||
|
||||
Reference in New Issue
Block a user