public EasyMethod CreateMethod(string name, MethodAttributes attrs, ReturnReferenceExpression returnType, params Type[] args) { EasyMethod method = new EasyMethod(this, name, attrs, returnType, ArgumentsUtil.ConvertToArgumentReference(args)); this._methods.Add(method); return(method); }
/// <summary> /// /// </summary> /// <param name="baseConstructor"></param> /// <returns></returns> protected virtual EasyConstructor GenerateConstructor(ConstructorInfo baseConstructor) { ArrayList list = new ArrayList(); ArgumentReference reference = new ArgumentReference(base.Context.Interceptor); ArgumentReference reference2 = new ArgumentReference(typeof(object[])); list.Add(reference); ParameterInfo[] parameters = baseConstructor.GetParameters(); if (base.Context.HasMixins) { list.Add(reference2); } ArgumentReference[] c = ArgumentsUtil.ConvertToArgumentReference(parameters); list.AddRange(c); EasyConstructor constructor = base.MainTypeBuilder.CreateConstructor((ArgumentReference[])list.ToArray(typeof(ArgumentReference))); this.GenerateConstructorCode(constructor.CodeBuilder, reference, SelfReference.Self, reference2); constructor.CodeBuilder.InvokeBaseConstructor(baseConstructor, c); constructor.CodeBuilder.AddStatement(new ReturnStatement()); return(constructor); }
public EasyCallable CreateCallable(Type returnType, params ParameterInfo[] args) { EasyCallable nested = new EasyCallable(this, base.IncrementAndGetCounterValue, new ReturnReferenceExpression(returnType), ArgumentsUtil.ConvertToArgumentReference(args)); base._nested.Add(nested); return(nested); }
public EasyMethod CreateSetMethod(MethodAttributes attrs, params Type[] parameters) { if (this._setMethod == null) { this._setMethod = new EasyMethod(this._maintype, "set_" + this._builder.Name, attrs, new ReturnReferenceExpression(typeof(void)), ArgumentsUtil.ConvertToArgumentReference(parameters)); } return(this._setMethod); }
public EasyMethod CreateRemoveOnMethod(MethodAttributes atts, params Type[] parameters) { if (this.m_removeOnMethod == null) { this.m_removeOnMethod = new EasyMethod(this.m_maintype, "remove_" + this.Name, atts, new ReturnReferenceExpression(typeof(void)), ArgumentsUtil.ConvertToArgumentReference(parameters)); } return(this.m_removeOnMethod); }