internal static MethodRef MethodBodyCtor(ClassRef klass) { MethodRef ctor = klass.GetMethod(".ctor"); if (ctor != null) return ctor; else { ctor = klass.AddMethod(".ctor", PrimitiveType.Void, new Type[0]); ctor.AddCallConv(CallConv.Instance); return ctor; } }
internal static MethodRef AddStaticMethod(ClassRef classRef, string name, PERWAPI.Type retType, PERWAPI.Type[] args) { MethodRef method = classRef.GetMethod(name, args); if (method == null) method = classRef.AddMethod(name, retType, args); return method; }
internal static MethodRef AddInstanceMethod(ClassRef classRef, string name, PERWAPI.Type retType, PERWAPI.Type[] args) { MethodRef method = classRef.GetMethod(name, args); if (method == null || method.GetCallConv() != CallConv.Instance) { method = classRef.AddMethod(name, retType, args); method.AddCallConv(CallConv.Instance); } return method; }