LocalBuilder.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // System.Reflection.Emit/LocalBuilder.cs
  3. //
  4. // Authors:
  5. // Paolo Molaro ([email protected])
  6. // Martin Baulig ([email protected])
  7. // Miguel de Icaza ([email protected])
  8. //
  9. // (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
  10. //
  11. using System;
  12. using System.Reflection;
  13. using System.Reflection.Emit;
  14. using System.Globalization;
  15. using System.Runtime.CompilerServices;
  16. using System.Diagnostics.SymbolStore;
  17. namespace System.Reflection.Emit {
  18. public sealed class LocalBuilder {
  19. //
  20. // These are kept in sync with reflection.h
  21. //
  22. #region Sync with reflection.h
  23. private Type type;
  24. private string name;
  25. #endregion
  26. //
  27. // Order does not matter after here
  28. //
  29. private ModuleBuilder module;
  30. internal uint position;
  31. internal LocalBuilder (ModuleBuilder m, Type t)
  32. {
  33. this.module = m;
  34. this.type = t;
  35. }
  36. public void SetLocalSymInfo (string lname, int startOffset, int endOffset)
  37. {
  38. this.name = lname;
  39. module.SymWriter_DefineLocalVariable (lname, this, FieldAttributes.Private,
  40. (int) position, startOffset, endOffset);
  41. }
  42. public void SetLocalSymInfo (string lname)
  43. {
  44. SetLocalSymInfo (lname, 0, 0);
  45. }
  46. public Type LocalType
  47. {
  48. get {
  49. return type;
  50. }
  51. }
  52. }
  53. }