Browse Source

Property evaluation code moved to ObjectValue

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@879 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
c93ae52d54
  1. 41
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs
  2. 48
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValue.cs

41
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Threads/Function.cs

@ -393,16 +393,13 @@ namespace Debugger @@ -393,16 +393,13 @@ namespace Debugger
public IEnumerable<Variable> Variables {
get {
foreach(Variable var in ContaingClassVariables) {
yield return var;
}
foreach(Variable var in ArgumentVariables) {
yield return var;
}
foreach(Variable var in LocalVariables) {
yield return var;
}
foreach(Variable var in PropertyVariables) {
foreach(Variable var in ContaingClassVariables) {
yield return var;
}
}
@ -484,42 +481,6 @@ namespace Debugger @@ -484,42 +481,6 @@ namespace Debugger
}
}
public IEnumerable<Variable> PropertyVariables {
get {
foreach(MethodProps m in module.MetaData.EnumMethods(methodProps.ClassToken)) {
MethodProps method = m; // One per scope/delegate
if (method.Name.StartsWith("get_") && method.HasSpecialName) {
yield return new PropertyVariable(debugger,
method.Name.Remove(0, 4),
delegate {
if (this.HasExpired) {
return null;
} else {
return CreatePropertyEval(method);
}
});
}
}
}
}
Eval CreatePropertyEval(MethodProps method)
{
ICorDebugFunction evalCorFunction;
Module.CorModule.GetFunctionFromToken(method.Token, out evalCorFunction);
return new Eval(debugger, evalCorFunction, GetEvalArgs);
}
ICorDebugValue[] GetEvalArgs()
{
if (IsStatic) {
return new ICorDebugValue[0];
} else {
return new ICorDebugValue[] {ThisValue.CorValue};
}
}
IEnumerable<Variable> GetLocalVariablesInScope(ISymbolScope symScope)
{
foreach (ISymbolVariable symVar in symScope.GetLocals()) {

48
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/ObjectValue.cs

@ -128,7 +128,18 @@ namespace Debugger @@ -128,7 +128,18 @@ namespace Debugger
yield return BaseClassVariable;
}
foreach(FieldProps f in metaData.EnumFields(classProps.Token)) {
foreach(Variable var in GetFieldVariables(getter)) {
yield return var;
}
foreach(Variable var in GetPropertyVariables(getter)) {
yield return var;
}
}
public IEnumerable<Variable> GetFieldVariables(ValueGetter getter)
{
foreach(FieldProps f in metaData.EnumFields(ClassToken)) {
FieldProps field = f; // One per scope/delegate
if (field.IsStatic && field.IsLiteral) continue; // Skip field
if (!field.IsStatic && corValue == null) continue; // Skip field
@ -136,6 +147,7 @@ namespace Debugger @@ -136,6 +147,7 @@ namespace Debugger
field.Name,
delegate {
Value updatedVal = getter();
if (updatedVal is UnavailableValue) return updatedVal;
if (this.IsEquivalentValue(updatedVal)) {
return GetValue(updatedVal, field);
} else {
@ -145,6 +157,40 @@ namespace Debugger @@ -145,6 +157,40 @@ namespace Debugger
}
}
public IEnumerable<Variable> GetPropertyVariables(ValueGetter getter)
{
foreach(MethodProps m in Methods) {
MethodProps method = m; // One per scope/delegate
if (method.Name.StartsWith("get_") && method.HasSpecialName) {
yield return new PropertyVariable(debugger,
method.Name.Remove(0, 4),
delegate {
Value updatedVal = getter();
if (updatedVal is UnavailableValue) return null;
if (this.IsEquivalentValue(updatedVal)) {
return CreatePropertyEval(method, getter);
} else {
return null;
}
});
}
}
}
Eval CreatePropertyEval(MethodProps method, ValueGetter getter)
{
ICorDebugFunction evalCorFunction;
Module.CorModule.GetFunctionFromToken(method.Token, out evalCorFunction);
return new Eval(debugger, evalCorFunction, delegate {
if (method.IsStatic) {
return new ICorDebugValue[] {};
} else {
return new ICorDebugValue[] {getter().CorValue};
}
});
}
public override bool IsEquivalentValue(Value val)
{
ObjectValue objVal = val as ObjectValue;

Loading…
Cancel
Save