예제 #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;
            }
예제 #2
0
파일: CecilType.cs 프로젝트: cm4ker/XamlIl
 public CecilType(CecilTypeSystem typeSystem, CecilAssembly assembly, TypeDefinition definition,
                  TypeReference reference)
 {
     _assembly  = assembly;
     TypeSystem = typeSystem;
     Reference  = reference;
     Definition = definition;
 }
예제 #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;
     }
 }
예제 #4
0
파일: CecilField.cs 프로젝트: cm4ker/XamlIl
 public CecilField(CecilTypeSystem typeSystem, FieldDefinition def, TypeReference declaringType)
 {
     TypeSystem = typeSystem;
     _def       = def;
     Field      = new FieldReference(def.Name, def.FieldType.TransformGeneric(declaringType), declaringType);
 }
예제 #5
0
 public CecilTypeBuilder(CecilTypeSystem typeSystem, CecilAssembly assembly, TypeDefinition definition)
     : base(typeSystem, assembly, definition)
 {
 }
예제 #6
0
 public CecilProperty(CecilTypeSystem typeSystem, PropertyDefinition property, TypeReference declaringType)
 {
     _declaringType = declaringType;
     TypeSystem     = typeSystem;
     Property       = property;
 }
예제 #7
0
 public CecilTypeCache(CecilTypeSystem typeSystem)
 {
     TypeSystem = typeSystem;
 }
예제 #8
0
 public CecilEvent(CecilTypeSystem typeSystem, EventDefinition ev, TypeReference declaringType)
 {
     _declaringType = declaringType;
     TypeSystem     = typeSystem;
     Event          = ev;
 }
예제 #9
0
 public CecilMethod(CecilTypeSystem typeSystem, MethodDefinition methodDef,
                    TypeReference declaringType) : base(typeSystem, methodDef, declaringType)
 {
 }
예제 #10
0
 public CecilAssembly(CecilTypeSystem typeSystem, AssemblyDefinition assembly)
 {
     TypeSystem = typeSystem;
     Assembly   = assembly;
 }
예제 #11
0
 public CecilCustomAttribute(CecilTypeSystem typeSystem, CustomAttribute data)
 {
     TypeSystem = typeSystem;
     Data       = data;
 }
예제 #12
0
파일: CecilType.cs 프로젝트: cm4ker/XamlIl
 public CecilType(CecilTypeSystem typeSystem, CecilAssembly assembly, TypeDefinition definition)
     : this(typeSystem, assembly, definition, definition)
 {
 }
예제 #13
0
 public CustomMetadataResolver(CecilTypeSystem typeSystem) : base(typeSystem)
 {
     _typeSystem = typeSystem;
 }