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; } }
public CecilMethodBase(CecilTypeSystem typeSystem, MethodReference 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)); } if (method is GenericInstanceMethod generic) { var genericReference = new GenericInstanceMethod(reference); foreach (var genericArg in generic.GenericArguments) { genericReference.GenericArguments.Add(Transform(genericArg)); } reference = genericReference; } return(reference); } Reference = MakeRef(true); IlReference = MakeRef(false); Definition = method.Resolve(); _declaringTypeReference = declaringType; }
public CecilTypeBuilder(CecilTypeSystem typeSystem, CecilAssembly assembly, TypeDefinition definition) : base(typeSystem, assembly, definition) { SelfReference = definition; }
public CecilCustomAttribute(CecilTypeSystem typeSystem, CustomAttribute data) { TypeSystem = typeSystem; Data = data; }
public CecilProperty(CecilTypeSystem typeSystem, PropertyDefinition property, TypeReference declaringType) { _declaringType = declaringType; TypeSystem = typeSystem; Property = property; }
public CecilType(CecilTypeSystem typeSystem, CecilAssembly assembly, TypeDefinition definition) : this(typeSystem, assembly, definition, definition) { }
public CecilTypeCache(CecilTypeSystem typeSystem) { TypeSystem = typeSystem; }
public CecilEvent(CecilTypeSystem typeSystem, EventDefinition ev, TypeReference declaringType) { _declaringType = declaringType; TypeSystem = typeSystem; Event = ev; }
public CecilAssembly(CecilTypeSystem typeSystem, AssemblyDefinition assembly) { TypeSystem = typeSystem; Assembly = assembly; }
public CecilConstructor(CecilTypeSystem typeSystem, MethodDefinition methodDef, TypeReference declaringType) : base(typeSystem, methodDef, declaringType) { }
public CecilMethod(CecilTypeSystem typeSystem, MethodReference methodRef, TypeReference declaringType) : base(typeSystem, methodRef, declaringType) { }
public CecilField(CecilTypeSystem typeSystem, FieldDefinition def, TypeReference declaringType) { TypeSystem = typeSystem; _def = def; Field = new FieldReference(def.Name, def.FieldType, declaringType); }
public CustomMetadataResolver(CecilTypeSystem typeSystem) : base(typeSystem) { _typeSystem = typeSystem; }