/Debugger/Debugger.Core/MetaData/DebugLocalVariableInfo.cs

http://github.com/icsharpcode/ILSpy · C# · 61 lines · 44 code · 9 blank · 8 comment · 1 complexity · 59221f9728891f527a8c0679afb77709 MD5 · raw file

  1. // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
  2. // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
  3. using System;
  4. namespace Debugger.MetaData
  5. {
  6. public class DebugLocalVariableInfo: System.Reflection.LocalVariableInfo
  7. {
  8. ValueGetter getter;
  9. int localIndex;
  10. DebugType localType;
  11. /// <inheritdoc/>
  12. public override int LocalIndex {
  13. get { return localIndex; }
  14. }
  15. /// <inheritdoc/>
  16. public override Type LocalType {
  17. get { return localType; }
  18. }
  19. /// <inheritdoc/>
  20. public override bool IsPinned {
  21. get { throw new NotSupportedException(); }
  22. }
  23. public string Name { get; internal set; }
  24. /// <summary> IL offset of the start of the variable scope (inclusive) </summary>
  25. public int StartOffset { get; private set; }
  26. /// <summary> IL offset of the end of the variable scope (exclusive) </summary>
  27. public int EndOffset { get; private set; }
  28. public bool IsThis { get; internal set; }
  29. public bool IsCaptured { get; internal set; }
  30. public DebugLocalVariableInfo(string name, int localIndex, int startOffset, int endOffset, DebugType localType, ValueGetter getter)
  31. {
  32. this.Name = name;
  33. this.localIndex = localIndex;
  34. this.StartOffset = startOffset;
  35. this.EndOffset = endOffset;
  36. this.localType = localType;
  37. this.getter = getter;
  38. }
  39. public Value GetValue(StackFrame context)
  40. {
  41. return getter(context);
  42. }
  43. /// <inheritdoc/>
  44. public override string ToString()
  45. {
  46. string msg = this.LocalType + " " + this.Name;
  47. if (IsCaptured)
  48. msg += " (captured)";
  49. return msg;
  50. }
  51. }
  52. }