protected override void DoLinkMethod() { ctor.Link(); DefineMethodHelper dmh = ctor.GetDefineMethodHelper(); constructorBuilder = dmh.DefineConstructor(context, typeBuilder, MethodAttributes.PrivateScope); AttributeHelper.HideFromJava(constructorBuilder); CodeEmitter ilgen = CodeEmitter.Create(constructorBuilder); ilgen.Emit(OpCodes.Ldarg_0); for (int i = 1; i <= dmh.ParameterCount; i++) { ilgen.Emit(OpCodes.Ldarg_S, (byte)i); } ctor.EmitCall(ilgen); ilgen.Emit(OpCodes.Ret); ilgen.DoEmit(); }
private static void SetParameters(ClassLoaderWrapper loader, ConstructorBuilder cb, IKVM.Internal.MapXml.Param[] parameters) { if(parameters != null) { for(int i = 0; i < parameters.Length; i++) { ParameterBuilder pb = cb.DefineParameter(i + 1, ParameterAttributes.None, parameters[i].Name); if(parameters[i].Attributes != null) { for(int j = 0; j < parameters[i].Attributes.Length; j++) { AttributeHelper.SetCustomAttribute(loader, pb, parameters[i].Attributes[j]); } } } } }
protected override void DoLinkMethod() { ctor.Link(); Type[] parameters = ctor.GetParametersForDefineMethod(); constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.PrivateScope, CallingConventions.Standard, parameters); AttributeHelper.HideFromJava(constructorBuilder); CodeEmitter ilgen = CodeEmitter.Create(constructorBuilder); ilgen.Emit(OpCodes.Ldarg_0); for (int i = 1; i <= parameters.Length; i++) { ilgen.Emit(OpCodes.Ldarg_S, (byte)i); } ctor.EmitCall(ilgen); ilgen.Emit(OpCodes.Ret); }