LocalBuilder.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. //
  2. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining
  5. // a copy of this software and associated documentation files (the
  6. // "Software"), to deal in the Software without restriction, including
  7. // without limitation the rights to use, copy, modify, merge, publish,
  8. // distribute, sublicense, and/or sell copies of the Software, and to
  9. // permit persons to whom the Software is furnished to do so, subject to
  10. // the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be
  13. // included in all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  19. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  20. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  21. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. //
  23. //
  24. // System.Reflection.Emit/LocalBuilder.cs
  25. //
  26. // Authors:
  27. // Paolo Molaro ([email protected])
  28. // Martin Baulig ([email protected])
  29. // Miguel de Icaza ([email protected])
  30. //
  31. // (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
  32. //
  33. using System;
  34. using System.Reflection;
  35. using System.Globalization;
  36. using System.Runtime.CompilerServices;
  37. using System.Runtime.InteropServices;
  38. using System.Diagnostics.SymbolStore;
  39. namespace System.Reflection.Emit {
  40. #if !MOBILE
  41. [ComVisible (true)]
  42. [ComDefaultInterface (typeof (_LocalBuilder))]
  43. [ClassInterface (ClassInterfaceType.None)]
  44. partial class LocalBuilder : _LocalBuilder
  45. {
  46. void _LocalBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
  47. {
  48. throw new NotImplementedException ();
  49. }
  50. void _LocalBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
  51. {
  52. throw new NotImplementedException ();
  53. }
  54. void _LocalBuilder.GetTypeInfoCount (out uint pcTInfo)
  55. {
  56. throw new NotImplementedException ();
  57. }
  58. void _LocalBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
  59. {
  60. throw new NotImplementedException ();
  61. }
  62. }
  63. #endif
  64. [StructLayout (LayoutKind.Sequential)]
  65. public sealed partial class LocalBuilder : LocalVariableInfo
  66. {
  67. // Some fields are already defined in LocalVariableInfo
  68. #region Sync with reflection.h
  69. private string name;
  70. #endregion
  71. internal ILGenerator ilgen;
  72. int startOffset;
  73. int endOffset;
  74. internal LocalBuilder (Type t, ILGenerator ilgen)
  75. {
  76. this.type = t;
  77. this.ilgen = ilgen;
  78. }
  79. public void SetLocalSymInfo (string name, int startOffset, int endOffset)
  80. {
  81. this.name = name;
  82. this.startOffset = startOffset;
  83. this.endOffset = endOffset;
  84. }
  85. public void SetLocalSymInfo (string name)
  86. {
  87. SetLocalSymInfo (name, 0, 0);
  88. }
  89. public override Type LocalType
  90. {
  91. get {
  92. return type;
  93. }
  94. }
  95. public override bool IsPinned
  96. {
  97. get {
  98. return is_pinned;
  99. }
  100. }
  101. public override int LocalIndex
  102. {
  103. get {
  104. return position;
  105. }
  106. }
  107. internal string Name {
  108. get { return name; }
  109. }
  110. internal int StartOffset {
  111. get { return startOffset; }
  112. }
  113. internal int EndOffset {
  114. get { return endOffset; }
  115. }
  116. }
  117. }