MethodBuilder.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. //
  2. // System.Reflection.Emit/MethodBuilder.cs
  3. //
  4. // Author:
  5. // Paolo Molaro ([email protected])
  6. //
  7. // (C) 2001 Ximian, Inc. http://www.ximian.com
  8. //
  9. //
  10. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  11. //
  12. // Permission is hereby granted, free of charge, to any person obtaining
  13. // a copy of this software and associated documentation files (the
  14. // "Software"), to deal in the Software without restriction, including
  15. // without limitation the rights to use, copy, modify, merge, publish,
  16. // distribute, sublicense, and/or sell copies of the Software, and to
  17. // permit persons to whom the Software is furnished to do so, subject to
  18. // the following conditions:
  19. //
  20. // The above copyright notice and this permission notice shall be
  21. // included in all copies or substantial portions of the Software.
  22. //
  23. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  27. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  28. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  29. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  30. //
  31. using System;
  32. using System.Reflection;
  33. using System.Reflection.Emit;
  34. using System.Globalization;
  35. using System.Security;
  36. using System.Security.Permissions;
  37. using System.Runtime.CompilerServices;
  38. using System.Runtime.InteropServices;
  39. using System.Diagnostics.SymbolStore;
  40. namespace System.Reflection.Emit
  41. {
  42. [ComVisible (true)]
  43. [ComDefaultInterface (typeof (_MethodBuilder))]
  44. [ClassInterface (ClassInterfaceType.None)]
  45. [StructLayout (LayoutKind.Sequential)]
  46. public sealed class MethodBuilder : MethodInfo, _MethodBuilder
  47. {
  48. #pragma warning disable 169, 414
  49. private RuntimeMethodHandle mhandle;
  50. private Type rtype;
  51. internal Type[] parameters;
  52. private MethodAttributes attrs; /* It's used directly by MCS */
  53. private MethodImplAttributes iattrs;
  54. private string name;
  55. private int table_idx;
  56. private byte[] code;
  57. private ILGenerator ilgen;
  58. private TypeBuilder type;
  59. internal ParameterBuilder[] pinfo;
  60. private CustomAttributeBuilder[] cattrs;
  61. private MethodInfo[] override_methods;
  62. private string pi_dll;
  63. private string pi_entry;
  64. private CharSet charset;
  65. private uint extra_flags; /* this encodes set_last_error etc */
  66. private CallingConvention native_cc;
  67. private CallingConventions call_conv;
  68. private bool init_locals = true;
  69. private IntPtr generic_container;
  70. internal GenericTypeParameterBuilder[] generic_params;
  71. private Type[] returnModReq;
  72. private Type[] returnModOpt;
  73. private Type[][] paramModReq;
  74. private Type[][] paramModOpt;
  75. private RefEmitPermissionSet[] permissions;
  76. #pragma warning restore 169, 414
  77. internal MethodBuilder (TypeBuilder tb, string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnModReq, Type[] returnModOpt, Type[] parameterTypes, Type[][] paramModReq, Type[][] paramModOpt)
  78. {
  79. this.name = name;
  80. this.attrs = attributes;
  81. this.call_conv = callingConvention;
  82. this.rtype = returnType;
  83. this.returnModReq = returnModReq;
  84. this.returnModOpt = returnModOpt;
  85. this.paramModReq = paramModReq;
  86. this.paramModOpt = paramModOpt;
  87. // The MSDN docs does not specify this, but the MS MethodBuilder
  88. // appends a HasThis flag if the method is not static
  89. if ((attributes & MethodAttributes.Static) == 0)
  90. this.call_conv |= CallingConventions.HasThis;
  91. if (parameterTypes != null) {
  92. for (int i = 0; i < parameterTypes.Length; ++i)
  93. if (parameterTypes [i] == null)
  94. throw new ArgumentException ("Elements of the parameterTypes array cannot be null", "parameterTypes");
  95. this.parameters = new Type [parameterTypes.Length];
  96. System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
  97. }
  98. type = tb;
  99. table_idx = get_next_table_index (this, 0x06, true);
  100. ((ModuleBuilder)tb.Module).RegisterToken (this, GetToken ().Token);
  101. }
  102. internal MethodBuilder (TypeBuilder tb, string name, MethodAttributes attributes,
  103. CallingConventions callingConvention, Type returnType, Type[] returnModReq, Type[] returnModOpt, Type[] parameterTypes, Type[][] paramModReq, Type[][] paramModOpt,
  104. String dllName, String entryName, CallingConvention nativeCConv, CharSet nativeCharset)
  105. : this (tb, name, attributes, callingConvention, returnType, returnModReq, returnModOpt, parameterTypes, paramModReq, paramModOpt)
  106. {
  107. pi_dll = dllName;
  108. pi_entry = entryName;
  109. native_cc = nativeCConv;
  110. charset = nativeCharset;
  111. }
  112. public override bool ContainsGenericParameters {
  113. get { throw new NotSupportedException (); }
  114. }
  115. public bool InitLocals {
  116. get {return init_locals;}
  117. set {init_locals = value;}
  118. }
  119. internal TypeBuilder TypeBuilder {
  120. get {return type;}
  121. }
  122. public override RuntimeMethodHandle MethodHandle {
  123. get {
  124. throw NotSupported ();
  125. }
  126. }
  127. public override Type ReturnType {
  128. get { return rtype; }
  129. }
  130. public override Type ReflectedType {
  131. get { return type; }
  132. }
  133. public override Type DeclaringType {
  134. get { return type; }
  135. }
  136. public override string Name {
  137. get { return name; }
  138. }
  139. public override MethodAttributes Attributes {
  140. get { return attrs; }
  141. }
  142. public override ICustomAttributeProvider ReturnTypeCustomAttributes {
  143. get { return null; }
  144. }
  145. public override CallingConventions CallingConvention {
  146. get { return call_conv; }
  147. }
  148. [MonoTODO("Not implemented")]
  149. public string Signature {
  150. get {
  151. throw new NotImplementedException ();
  152. }
  153. }
  154. /* Used by mcs */
  155. internal bool BestFitMapping {
  156. set {
  157. extra_flags = (uint) ((extra_flags & ~0x30) | (uint)(value ? 0x10 : 0x20));
  158. }
  159. }
  160. /* Used by mcs */
  161. internal bool ThrowOnUnmappableChar {
  162. set {
  163. extra_flags = (uint) ((extra_flags & ~0x3000) | (uint)(value ? 0x1000 : 0x2000));
  164. }
  165. }
  166. /* Used by mcs */
  167. internal bool ExactSpelling {
  168. set {
  169. extra_flags = (uint) ((extra_flags & ~0x01) | (uint)(value ? 0x01 : 0x00));
  170. }
  171. }
  172. /* Used by mcs */
  173. internal bool SetLastError {
  174. set {
  175. extra_flags = (uint) ((extra_flags & ~0x40) | (uint)(value ? 0x40 : 0x00));
  176. }
  177. }
  178. public MethodToken GetToken()
  179. {
  180. return new MethodToken(0x06000000 | table_idx);
  181. }
  182. public override MethodInfo GetBaseDefinition()
  183. {
  184. return this;
  185. }
  186. public override MethodImplAttributes GetMethodImplementationFlags()
  187. {
  188. return iattrs;
  189. }
  190. public override ParameterInfo[] GetParameters()
  191. {
  192. if (!type.is_created)
  193. throw NotSupported ();
  194. if (parameters == null)
  195. return null;
  196. ParameterInfo[] retval = new ParameterInfo [parameters.Length];
  197. for (int i = 0; i < parameters.Length; i++) {
  198. retval [i] = new ParameterInfo (pinfo == null ? null : pinfo [i + 1], parameters [i], this, i + 1);
  199. }
  200. return retval;
  201. }
  202. internal override int GetParameterCount ()
  203. {
  204. if (parameters == null)
  205. return 0;
  206. return parameters.Length;
  207. }
  208. internal override Type GetParameterType (int pos) {
  209. return parameters [pos];
  210. }
  211. public Module GetModule ()
  212. {
  213. return type.Module;
  214. }
  215. public void CreateMethodBody (byte[] il, int count)
  216. {
  217. if ((il != null) && ((count < 0) || (count > il.Length)))
  218. throw new ArgumentOutOfRangeException ("Index was out of range. Must be non-negative and less than the size of the collection.");
  219. if ((code != null) || type.is_created)
  220. throw new InvalidOperationException ("Type definition of the method is complete.");
  221. if (il == null)
  222. code = null;
  223. else {
  224. code = new byte [count];
  225. System.Array.Copy(il, code, count);
  226. }
  227. }
  228. public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
  229. {
  230. throw NotSupported ();
  231. }
  232. public override bool IsDefined (Type attributeType, bool inherit)
  233. {
  234. throw NotSupported ();
  235. }
  236. public override object[] GetCustomAttributes (bool inherit)
  237. {
  238. /*
  239. * On MS.NET, this always returns not_supported, but we can't do this
  240. * since there would be no way to obtain custom attributes of
  241. * dynamically created ctors.
  242. */
  243. if (type.is_created)
  244. return MonoCustomAttrs.GetCustomAttributes (this, inherit);
  245. else
  246. throw NotSupported ();
  247. }
  248. public override object[] GetCustomAttributes (Type attributeType, bool inherit)
  249. {
  250. if (type.is_created)
  251. return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
  252. else
  253. throw NotSupported ();
  254. }
  255. public ILGenerator GetILGenerator ()
  256. {
  257. return GetILGenerator (64);
  258. }
  259. public ILGenerator GetILGenerator (int size)
  260. {
  261. if (((iattrs & MethodImplAttributes.CodeTypeMask) !=
  262. MethodImplAttributes.IL) ||
  263. ((iattrs & MethodImplAttributes.ManagedMask) !=
  264. MethodImplAttributes.Managed))
  265. throw new InvalidOperationException ("Method body should not exist.");
  266. if (ilgen != null)
  267. return ilgen;
  268. ilgen = new ILGenerator (type.Module, ((ModuleBuilder)type.Module).GetTokenGenerator (), size);
  269. return ilgen;
  270. }
  271. public ParameterBuilder DefineParameter (int position, ParameterAttributes attributes, string strParamName)
  272. {
  273. RejectIfCreated ();
  274. //
  275. // Extension: Mono allows position == 0 for the return attribute
  276. //
  277. if ((position < 0) || (position > parameters.Length))
  278. throw new ArgumentOutOfRangeException ("position");
  279. ParameterBuilder pb = new ParameterBuilder (this, position, attributes, strParamName);
  280. if (pinfo == null)
  281. pinfo = new ParameterBuilder [parameters.Length + 1];
  282. pinfo [position] = pb;
  283. return pb;
  284. }
  285. internal void check_override ()
  286. {
  287. if (override_methods != null) {
  288. foreach (var m in override_methods) {
  289. if (m.IsVirtual && !IsVirtual)
  290. throw new TypeLoadException (String.Format("Method '{0}' override '{1}' but it is not virtual", name, m));
  291. }
  292. }
  293. }
  294. internal void fixup ()
  295. {
  296. if (((attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == 0) && ((iattrs & (MethodImplAttributes.Runtime | MethodImplAttributes.InternalCall)) == 0)) {
  297. // do not allow zero length method body on MS.NET 2.0 (and higher)
  298. if (((ilgen == null) || (ilgen.ILOffset == 0)) && (code == null || code.Length == 0))
  299. throw new InvalidOperationException (
  300. String.Format ("Method '{0}.{1}' does not have a method body.",
  301. DeclaringType.FullName, Name));
  302. }
  303. if (ilgen != null)
  304. ilgen.label_fixup ();
  305. }
  306. internal void GenerateDebugInfo (ISymbolWriter symbolWriter)
  307. {
  308. if (ilgen != null && ilgen.HasDebugInfo) {
  309. SymbolToken token = new SymbolToken (GetToken().Token);
  310. symbolWriter.OpenMethod (token);
  311. symbolWriter.SetSymAttribute (token, "__name", System.Text.Encoding.UTF8.GetBytes (Name));
  312. ilgen.GenerateDebugInfo (symbolWriter);
  313. symbolWriter.CloseMethod ();
  314. }
  315. }
  316. public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
  317. {
  318. if (customBuilder == null)
  319. throw new ArgumentNullException ("customBuilder");
  320. switch (customBuilder.Ctor.ReflectedType.FullName) {
  321. case "System.Runtime.CompilerServices.MethodImplAttribute":
  322. byte[] data = customBuilder.Data;
  323. int impla; // the (stupid) ctor takes a short or an int ...
  324. impla = (int)data [2];
  325. impla |= ((int)data [3]) << 8;
  326. iattrs |= (MethodImplAttributes)impla;
  327. return;
  328. case "System.Runtime.InteropServices.DllImportAttribute":
  329. CustomAttributeBuilder.CustomAttributeInfo attr = CustomAttributeBuilder.decode_cattr (customBuilder);
  330. bool preserveSig = true;
  331. /*
  332. * It would be easier to construct a DllImportAttribute from
  333. * the custom attribute builder, but the DllImportAttribute
  334. * does not contain all the information required here, ie.
  335. * - some parameters, like BestFitMapping has three values
  336. * ("on", "off", "missing"), but DllImportAttribute only
  337. * contains two (on/off).
  338. * - PreserveSig is true by default, while it is false by
  339. * default in DllImportAttribute.
  340. */
  341. pi_dll = (string)attr.ctorArgs[0];
  342. if (pi_dll == null || pi_dll.Length == 0)
  343. throw new ArgumentException ("DllName cannot be empty");
  344. native_cc = System.Runtime.InteropServices.CallingConvention.Winapi;
  345. for (int i = 0; i < attr.namedParamNames.Length; ++i) {
  346. string name = attr.namedParamNames [i];
  347. object value = attr.namedParamValues [i];
  348. if (name == "CallingConvention")
  349. native_cc = (CallingConvention)value;
  350. else if (name == "CharSet")
  351. charset = (CharSet)value;
  352. else if (name == "EntryPoint")
  353. pi_entry = (string)value;
  354. else if (name == "ExactSpelling")
  355. ExactSpelling = (bool)value;
  356. else if (name == "SetLastError")
  357. SetLastError = (bool)value;
  358. else if (name == "PreserveSig")
  359. preserveSig = (bool)value;
  360. else if (name == "BestFitMapping")
  361. BestFitMapping = (bool)value;
  362. else if (name == "ThrowOnUnmappableChar")
  363. ThrowOnUnmappableChar = (bool)value;
  364. }
  365. attrs |= MethodAttributes.PinvokeImpl;
  366. if (preserveSig)
  367. iattrs |= MethodImplAttributes.PreserveSig;
  368. return;
  369. case "System.Runtime.InteropServices.PreserveSigAttribute":
  370. iattrs |= MethodImplAttributes.PreserveSig;
  371. return;
  372. case "System.Runtime.CompilerServices.SpecialNameAttribute":
  373. attrs |= MethodAttributes.SpecialName;
  374. return;
  375. case "System.Security.SuppressUnmanagedCodeSecurityAttribute":
  376. attrs |= MethodAttributes.HasSecurity;
  377. break;
  378. }
  379. if (cattrs != null) {
  380. CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
  381. cattrs.CopyTo (new_array, 0);
  382. new_array [cattrs.Length] = customBuilder;
  383. cattrs = new_array;
  384. } else {
  385. cattrs = new CustomAttributeBuilder [1];
  386. cattrs [0] = customBuilder;
  387. }
  388. }
  389. [ComVisible (true)]
  390. public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
  391. {
  392. if (con == null)
  393. throw new ArgumentNullException ("con");
  394. if (binaryAttribute == null)
  395. throw new ArgumentNullException ("binaryAttribute");
  396. SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
  397. }
  398. public void SetImplementationFlags (MethodImplAttributes attributes)
  399. {
  400. RejectIfCreated ();
  401. iattrs = attributes;
  402. }
  403. public void AddDeclarativeSecurity (SecurityAction action, PermissionSet pset)
  404. {
  405. #if !NET_2_1
  406. if (pset == null)
  407. throw new ArgumentNullException ("pset");
  408. if ((action == SecurityAction.RequestMinimum) ||
  409. (action == SecurityAction.RequestOptional) ||
  410. (action == SecurityAction.RequestRefuse))
  411. throw new ArgumentOutOfRangeException ("Request* values are not permitted", "action");
  412. RejectIfCreated ();
  413. if (permissions != null) {
  414. /* Check duplicate actions */
  415. foreach (RefEmitPermissionSet set in permissions)
  416. if (set.action == action)
  417. throw new InvalidOperationException ("Multiple permission sets specified with the same SecurityAction.");
  418. RefEmitPermissionSet[] new_array = new RefEmitPermissionSet [permissions.Length + 1];
  419. permissions.CopyTo (new_array, 0);
  420. permissions = new_array;
  421. }
  422. else
  423. permissions = new RefEmitPermissionSet [1];
  424. permissions [permissions.Length - 1] = new RefEmitPermissionSet (action, pset.ToXml ().ToString ());
  425. attrs |= MethodAttributes.HasSecurity;
  426. #endif
  427. }
  428. [Obsolete ("An alternate API is available: Emit the MarshalAs custom attribute instead.")]
  429. public void SetMarshal (UnmanagedMarshal unmanagedMarshal)
  430. {
  431. RejectIfCreated ();
  432. throw new NotImplementedException ();
  433. }
  434. [MonoTODO]
  435. public void SetSymCustomAttribute (string name, byte[] data)
  436. {
  437. RejectIfCreated ();
  438. throw new NotImplementedException ();
  439. }
  440. public override string ToString()
  441. {
  442. return "MethodBuilder [" + type.Name + "::" + name + "]";
  443. }
  444. [MonoTODO]
  445. public override bool Equals (object obj)
  446. {
  447. return base.Equals (obj);
  448. }
  449. public override int GetHashCode ()
  450. {
  451. return name.GetHashCode ();
  452. }
  453. internal override int get_next_table_index (object obj, int table, bool inc)
  454. {
  455. return type.get_next_table_index (obj, table, inc);
  456. }
  457. void ExtendArray<T> (ref T[] array, T elem) {
  458. if (array == null) {
  459. array = new T [1];
  460. } else {
  461. var newa = new T [array.Length + 1];
  462. Array.Copy (array, newa, array.Length);
  463. array = newa;
  464. }
  465. array [array.Length - 1] = elem;
  466. }
  467. internal void set_override (MethodInfo mdecl)
  468. {
  469. ExtendArray<MethodInfo> (ref override_methods, mdecl);
  470. }
  471. private void RejectIfCreated ()
  472. {
  473. if (type.is_created)
  474. throw new InvalidOperationException ("Type definition of the method is complete.");
  475. }
  476. private Exception NotSupported ()
  477. {
  478. return new NotSupportedException ("The invoked member is not supported in a dynamic module.");
  479. }
  480. public override MethodInfo MakeGenericMethod (params Type [] typeArguments)
  481. {
  482. if (!IsGenericMethodDefinition)
  483. throw new InvalidOperationException ("Method is not a generic method definition");
  484. if (typeArguments == null)
  485. throw new ArgumentNullException ("typeArguments");
  486. if (generic_params.Length != typeArguments.Length)
  487. throw new ArgumentException ("Incorrect length", "typeArguments");
  488. foreach (Type type in typeArguments) {
  489. if (type == null)
  490. throw new ArgumentNullException ("typeArguments");
  491. }
  492. return new MethodOnTypeBuilderInst (this, typeArguments);
  493. }
  494. public override bool IsGenericMethodDefinition {
  495. get {
  496. return generic_params != null;
  497. }
  498. }
  499. public override bool IsGenericMethod {
  500. get {
  501. return generic_params != null;
  502. }
  503. }
  504. public override MethodInfo GetGenericMethodDefinition ()
  505. {
  506. if (!IsGenericMethodDefinition)
  507. throw new InvalidOperationException ();
  508. return this;
  509. }
  510. public override Type[] GetGenericArguments ()
  511. {
  512. if (generic_params == null)
  513. return null;
  514. Type[] result = new Type [generic_params.Length];
  515. for (int i = 0; i < generic_params.Length; i++)
  516. result [i] = generic_params [i];
  517. return result;
  518. }
  519. public GenericTypeParameterBuilder[] DefineGenericParameters (params string[] names)
  520. {
  521. if (names == null)
  522. throw new ArgumentNullException ("names");
  523. if (names.Length == 0)
  524. throw new ArgumentException ("names");
  525. generic_params = new GenericTypeParameterBuilder [names.Length];
  526. for (int i = 0; i < names.Length; i++) {
  527. string item = names [i];
  528. if (item == null)
  529. throw new ArgumentNullException ("names");
  530. generic_params [i] = new GenericTypeParameterBuilder (type, this, item, i);
  531. }
  532. return generic_params;
  533. }
  534. public void SetReturnType (Type returnType)
  535. {
  536. rtype = returnType;
  537. }
  538. public void SetParameters (params Type[] parameterTypes)
  539. {
  540. if (parameterTypes != null) {
  541. for (int i = 0; i < parameterTypes.Length; ++i)
  542. if (parameterTypes [i] == null)
  543. throw new ArgumentException ("Elements of the parameterTypes array cannot be null", "parameterTypes");
  544. this.parameters = new Type [parameterTypes.Length];
  545. System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
  546. }
  547. }
  548. public void SetSignature (Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
  549. {
  550. SetReturnType (returnType);
  551. SetParameters (parameterTypes);
  552. this.returnModReq = returnTypeRequiredCustomModifiers;
  553. this.returnModOpt = returnTypeOptionalCustomModifiers;
  554. this.paramModReq = parameterTypeRequiredCustomModifiers;
  555. this.paramModOpt = parameterTypeOptionalCustomModifiers;
  556. }
  557. public override Module Module {
  558. get {
  559. return base.Module;
  560. }
  561. }
  562. void _MethodBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
  563. {
  564. throw new NotImplementedException ();
  565. }
  566. void _MethodBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
  567. {
  568. throw new NotImplementedException ();
  569. }
  570. void _MethodBuilder.GetTypeInfoCount (out uint pcTInfo)
  571. {
  572. throw new NotImplementedException ();
  573. }
  574. void _MethodBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
  575. {
  576. throw new NotImplementedException ();
  577. }
  578. #if NET_4_0 || MOONLIGHT
  579. public override ParameterInfo ReturnParameter {
  580. get { return base.ReturnParameter; }
  581. }
  582. #endif
  583. }
  584. }