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

github.com/mono/cecil.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Mono.Cecil/Import.cs')
-rw-r--r--Mono.Cecil/Import.cs34
1 files changed, 8 insertions, 26 deletions
diff --git a/Mono.Cecil/Import.cs b/Mono.Cecil/Import.cs
index 661e867..362e490 100644
--- a/Mono.Cecil/Import.cs
+++ b/Mono.Cecil/Import.cs
@@ -8,6 +8,8 @@
// Licensed under the MIT/X11 license.
//
+#if !READ_ONLY
+
using System;
using System.Collections.Generic;
using Mono.Collections.Generic;
@@ -29,7 +31,7 @@ namespace Mono.Cecil {
MethodReference ImportReference (MethodReference method, IGenericParameterProvider context);
}
-#if !CF
+#if !PCL
public interface IReflectionImporterProvider {
IReflectionImporter GetReflectionImporter (ModuleDefinition module);
@@ -40,6 +42,7 @@ namespace Mono.Cecil {
FieldReference ImportReference (SR.FieldInfo field, IGenericParameterProvider context);
MethodReference ImportReference (SR.MethodBase method, IGenericParameterProvider context);
}
+
#endif
struct ImportGenericContext {
@@ -121,7 +124,7 @@ namespace Mono.Cecil {
}
-#if !CF
+#if !PCL
public class ReflectionImporter : IReflectionImporter {
readonly ModuleDefinition module;
@@ -201,11 +204,7 @@ namespace Mono.Cecil {
static bool IsNestedType (Type type)
{
-#if !SILVERLIGHT
return type.IsNested;
-#else
- return type.DeclaringType != null;
-#endif
}
TypeReference ImportTypeSpecification (Type type, ImportGenericContext context)
@@ -292,7 +291,7 @@ namespace Mono.Cecil {
AssemblyNameReference ImportScope (SR.Assembly assembly)
{
AssemblyNameReference scope;
-#if !SILVERLIGHT
+
var name = assembly.GetName ();
if (TryGetAssemblyNameReference (name, out scope))
@@ -307,19 +306,8 @@ namespace Mono.Cecil {
module.AssemblyReferences.Add (scope);
return scope;
-#else
- var name = AssemblyNameReference.Parse (assembly.FullName);
-
- if (module.TryGetAssemblyNameReference (name, out scope))
- return scope;
-
- module.AssemblyReferences.Add (name);
-
- return name;
-#endif
}
-#if !SILVERLIGHT
bool TryGetAssemblyNameReference (SR.AssemblyName name, out AssemblyNameReference assembly_reference)
{
var references = module.AssemblyReferences;
@@ -336,7 +324,6 @@ namespace Mono.Cecil {
assembly_reference = null;
return false;
}
-#endif
FieldReference ImportField (SR.FieldInfo field, ImportGenericContext context)
{
@@ -359,14 +346,7 @@ namespace Mono.Cecil {
static SR.FieldInfo ResolveFieldDefinition (SR.FieldInfo field)
{
-#if !SILVERLIGHT
return field.Module.ResolveField (field.MetadataToken);
-#else
- return field.DeclaringType.GetGenericTypeDefinition ().GetField (field.Name,
- SR.BindingFlags.Public
- | SR.BindingFlags.NonPublic
- | (field.IsStatic ? SR.BindingFlags.Static : SR.BindingFlags.Instance));
-#endif
}
MethodReference ImportMethod (SR.MethodBase method, ImportGenericContext context, ImportGenericKind import_kind)
@@ -810,3 +790,5 @@ namespace Mono.Cecil {
#endif
}
+
+#endif