// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
namespace Debugger.MetaData
{
public class DebugLocalVariableInfo: System.Reflection.LocalVariableInfo
{
ValueGetter getter;
int localIndex;
DebugType localType;
///
public override int LocalIndex {
get { return localIndex; }
}
///
public override Type LocalType {
get { return localType; }
}
///
public override bool IsPinned {
get { throw new NotSupportedException(); }
}
public string Name { get; internal set; }
/// IL offset of the start of the variable scope (inclusive)
public int StartOffset { get; private set; }
/// IL offset of the end of the variable scope (exclusive)
public int EndOffset { get; private set; }
public bool IsThis { get; internal set; }
public bool IsCaptured { get; internal set; }
public DebugLocalVariableInfo(string name, int localIndex, int startOffset, int endOffset, DebugType localType, ValueGetter getter)
{
this.Name = name;
this.localIndex = localIndex;
this.StartOffset = startOffset;
this.EndOffset = endOffset;
this.localType = localType;
this.getter = getter;
}
public Value GetValue(StackFrame context)
{
return getter(context);
}
///
public override string ToString()
{
string msg = this.LocalType + " " + this.Name;
if (IsCaptured)
msg += " (captured)";
return msg;
}
}
}