Browse Source

Creation of expression does not evaluate the expression.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2788 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
775f2fc891
  1. 67
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.Create.cs

67
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/Expressions/Expression.Create.cs

@ -29,6 +29,15 @@ namespace Debugger @@ -29,6 +29,15 @@ namespace Debugger
);
}
public ExpressionCollection AppendIndexers(ArrayDimensions dimensions)
{
ExpressionCollection elements = new ExpressionCollection();
foreach(int[] indices in dimensions.Indices) {
elements.Add(this.AppendIndexer(indices));
}
return elements;
}
public Expression AppendFieldReference(FieldInfo fieldInfo)
{
return new Ast.FieldReferenceExpression(
@ -45,6 +54,20 @@ namespace Debugger @@ -45,6 +54,20 @@ namespace Debugger
);
}
public ExpressionCollection AppendObjectMembers(DebugType type, BindingFlags bindingFlags)
{
ExpressionCollection members = new ExpressionCollection();
foreach(FieldInfo field in type.GetFields(bindingFlags)) {
members.Add(this.AppendFieldReference(field));
}
foreach(PropertyInfo property in type.GetProperties(bindingFlags)) {
members.Add(this.AppendPropertyReference(property));
}
return members;
}
/// <summary> Get all variables for a method - this; parameters; local variables </summary>
public static ExpressionCollection MethodVariables(MethodInfo methodInfo)
{
@ -88,49 +111,5 @@ namespace Debugger @@ -88,49 +111,5 @@ namespace Debugger
return vars;
}
/// <summary>
/// Evaluate the expression and return expressions for all array elements.
/// The expression must evaluate to array.
/// </summary>
public ExpressionCollection EvaluateAndGetArrayElements()
{
ExpressionCollection elements = new ExpressionCollection();
foreach(int[] indices in this.Evaluate().ArrayDimensions.Indices) {
elements.Add(this.AppendIndexer(indices));
}
return elements;
}
/// <summary>
/// Evaluate the expression and return object members.
/// The expression must evaluate to object.
/// </summary>
public ExpressionCollection EvaluateAndGetObjectMembers(BindingFlags bindingFlags)
{
ExpressionCollection members = new ExpressionCollection();
DebugType currentType = this.Evaluate().Type;
while (currentType != null) {
members.AddRange(GetObjectMembers(currentType, bindingFlags));
currentType = currentType.BaseType;
}
return members;
}
public ExpressionCollection GetObjectMembers(DebugType type, BindingFlags bindingFlags)
{
ExpressionCollection members = new ExpressionCollection();
foreach(FieldInfo field in type.GetFields(bindingFlags)) {
members.Add(this.AppendFieldReference(field));
}
foreach(PropertyInfo property in type.GetProperties(bindingFlags)) {
members.Add(this.AppendPropertyReference(property));
}
return members;
}
}
}

Loading…
Cancel
Save