PageRenderTime 21ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 4using System;
 5
 6namespace Debugger.MetaData
 7{
 8	public class DebugLocalVariableInfo: System.Reflection.LocalVariableInfo
 9	{
10		ValueGetter getter;
11		int localIndex;
12		DebugType localType;
13		
14		/// <inheritdoc/>
15		public override int LocalIndex {
16			get { return localIndex; }
17		}
18		
19		/// <inheritdoc/>
20		public override Type LocalType {
21			get { return localType; }
22		}
23		
24		/// <inheritdoc/>
25		public override bool IsPinned {
26			get { throw new NotSupportedException(); }
27		}
28		
29		public string Name { get; internal set; }
30		/// <summary> IL offset of the start of the variable scope (inclusive) </summary>
31		public int StartOffset { get; private set; }
32		/// <summary> IL offset of the end of the variable scope (exclusive) </summary>
33		public int EndOffset { get; private set; }
34		public bool IsThis { get; internal set; }
35		public bool IsCaptured { get; internal set; }
36		
37		public DebugLocalVariableInfo(string name, int localIndex, int startOffset, int endOffset, DebugType localType, ValueGetter getter)
38		{
39			this.Name = name;
40			this.localIndex = localIndex;
41			this.StartOffset = startOffset;
42			this.EndOffset = endOffset;
43			this.localType = localType;
44			this.getter = getter;
45		}
46		
47		public Value GetValue(StackFrame context)
48		{
49			return getter(context);
50		}
51		
52		/// <inheritdoc/>
53		public override string ToString()
54		{
55			string msg = this.LocalType + " " + this.Name;
56			if (IsCaptured)
57				msg += " (captured)";
58			return msg;
59		}
60	}
61}