internal void GenerateMethods(Type type, ISubjectCoder sc) { sc.Start(this); var definedProperties = new Dictionary <PropertyInfo, PropertyBuilder>(); foreach (var subjectMethod in SubjectMethod.GetAllForType(type)) { var pi = subjectMethod.PropertyInfo; var mi = subjectMethod.MethodInfo; if (pi != null) { // If this is the first method in the property, define the property PropertyBuilder property; if (!definedProperties.TryGetValue(pi, out property)) { property = DefineProperty(pi); definedProperties.Add(pi, property); } // Define the method and attach it to the property var method = DefineMethod(mi); sc.GenerateMethod(pi, mi, method.GetILGenerator()); if (pi.GetGetMethod() == mi) { property.SetGetMethod(method); } else { property.SetSetMethod(method); } } else { var method = DefineMethod(mi); sc.GenerateMethod(null, mi, method.GetILGenerator()); } } }
public SubjectCoderContext(ProxyCodeBuilder pcb, IMixinCoder mixinCoder, ISubjectDescriptor subject) { _pcb = pcb; _subject = subject; _subjectCoder = subject.CreateCoder(mixinCoder, pcb); }
public void GenerateMethods(Type type, ISubjectCoder sc) { }