/Mono.Cecil/MethodSpecification.cs

http://github.com/jbevain/cecil · C# · 84 lines · 56 code · 19 blank · 9 comment · 0 complexity · 502158422ed9899a6c4801eae0a3f82b MD5 · raw file

  1. //
  2. // Author:
  3. // Jb Evain (jbevain@gmail.com)
  4. //
  5. // Copyright (c) 2008 - 2015 Jb Evain
  6. // Copyright (c) 2008 - 2011 Novell, Inc.
  7. //
  8. // Licensed under the MIT/X11 license.
  9. //
  10. using System;
  11. using Mono.Collections.Generic;
  12. namespace Mono.Cecil {
  13. public abstract class MethodSpecification : MethodReference {
  14. readonly MethodReference method;
  15. public MethodReference ElementMethod {
  16. get { return method; }
  17. }
  18. public override string Name {
  19. get { return method.Name; }
  20. set { throw new InvalidOperationException (); }
  21. }
  22. public override MethodCallingConvention CallingConvention {
  23. get { return method.CallingConvention; }
  24. set { throw new InvalidOperationException (); }
  25. }
  26. public override bool HasThis {
  27. get { return method.HasThis; }
  28. set { throw new InvalidOperationException (); }
  29. }
  30. public override bool ExplicitThis {
  31. get { return method.ExplicitThis; }
  32. set { throw new InvalidOperationException (); }
  33. }
  34. public override MethodReturnType MethodReturnType {
  35. get { return method.MethodReturnType; }
  36. set { throw new InvalidOperationException (); }
  37. }
  38. public override TypeReference DeclaringType {
  39. get { return method.DeclaringType; }
  40. set { throw new InvalidOperationException (); }
  41. }
  42. public override ModuleDefinition Module {
  43. get { return method.Module; }
  44. }
  45. public override bool HasParameters {
  46. get { return method.HasParameters; }
  47. }
  48. public override Collection<ParameterDefinition> Parameters {
  49. get { return method.Parameters; }
  50. }
  51. public override bool ContainsGenericParameter {
  52. get { return method.ContainsGenericParameter; }
  53. }
  54. internal MethodSpecification (MethodReference method)
  55. {
  56. Mixin.CheckMethod (method);
  57. this.method = method;
  58. this.token = new MetadataToken (TokenType.MethodSpec);
  59. }
  60. public sealed override MethodReference GetElementMethod ()
  61. {
  62. return method.GetElementMethod ();
  63. }
  64. }
  65. }