MethodBuilder.cs 20 KB

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