Exemple #1
0
            public CecilMethodBase(CecilTypeSystem typeSystem, MethodDefinition method, TypeReference declaringType)
            {
                TypeSystem = typeSystem;

                MethodReference MakeRef(bool transform)
                {
                    TypeReference Transform(TypeReference r) => transform?r.TransformGeneric(declaringType) : r;

                    var reference = new MethodReference(method.Name, Transform(method.ReturnType),
                                                        declaringType)
                    {
                        HasThis      = method.HasThis,
                        ExplicitThis = method.ExplicitThis,
                    };

                    foreach (ParameterDefinition parameter in method.Parameters)
                    {
                        reference.Parameters.Add(
                            new ParameterDefinition(Transform(parameter.ParameterType)));
                    }

                    foreach (var genericParam in method.GenericParameters)
                    {
                        reference.GenericParameters.Add(new GenericParameter(genericParam.Name, reference));
                    }
                    return(reference);
                }

                Reference               = MakeRef(true);
                IlReference             = MakeRef(false);
                Definition              = method;
                _declaringTypeReference = declaringType;
            }
Exemple #2
0
 public CecilType(CecilTypeSystem typeSystem, CecilAssembly assembly, TypeDefinition definition,
                  TypeReference reference)
 {
     _assembly  = assembly;
     TypeSystem = typeSystem;
     Reference  = reference;
     Definition = definition;
 }
Exemple #3
0
 public CecilType(CecilTypeSystem typeSystem, CecilAssembly assembly, TypeDefinition definition,
                  TypeReference reference)
 {
     _assembly  = assembly;
     TypeSystem = typeSystem;
     Reference  = reference;
     Definition = definition;
     if (reference.IsArray)
     {
         Definition = ((CecilType)typeSystem.GetType("System.Array")).Definition;
     }
 }
Exemple #4
0
 public CecilField(CecilTypeSystem typeSystem, FieldDefinition def, TypeReference declaringType)
 {
     TypeSystem = typeSystem;
     _def       = def;
     Field      = new FieldReference(def.Name, def.FieldType.TransformGeneric(declaringType), declaringType);
 }
Exemple #5
0
 public CecilTypeBuilder(CecilTypeSystem typeSystem, CecilAssembly assembly, TypeDefinition definition)
     : base(typeSystem, assembly, definition)
 {
 }
Exemple #6
0
 public CecilProperty(CecilTypeSystem typeSystem, PropertyDefinition property, TypeReference declaringType)
 {
     _declaringType = declaringType;
     TypeSystem     = typeSystem;
     Property       = property;
 }
Exemple #7
0
 public CecilTypeCache(CecilTypeSystem typeSystem)
 {
     TypeSystem = typeSystem;
 }
Exemple #8
0
 public CecilEvent(CecilTypeSystem typeSystem, EventDefinition ev, TypeReference declaringType)
 {
     _declaringType = declaringType;
     TypeSystem     = typeSystem;
     Event          = ev;
 }
Exemple #9
0
 public CecilMethod(CecilTypeSystem typeSystem, MethodDefinition methodDef,
                    TypeReference declaringType) : base(typeSystem, methodDef, declaringType)
 {
 }
Exemple #10
0
 public CecilAssembly(CecilTypeSystem typeSystem, AssemblyDefinition assembly)
 {
     TypeSystem = typeSystem;
     Assembly   = assembly;
 }
 public CecilCustomAttribute(CecilTypeSystem typeSystem, CustomAttribute data)
 {
     TypeSystem = typeSystem;
     Data       = data;
 }
Exemple #12
0
 public CecilType(CecilTypeSystem typeSystem, CecilAssembly assembly, TypeDefinition definition)
     : this(typeSystem, assembly, definition, definition)
 {
 }
 public CustomMetadataResolver(CecilTypeSystem typeSystem) : base(typeSystem)
 {
     _typeSystem = typeSystem;
 }