Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/LiteralValueReference.cs')
-rw-r--r--main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/LiteralValueReference.cs41
1 files changed, 39 insertions, 2 deletions
diff --git a/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/LiteralValueReference.cs b/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/LiteralValueReference.cs
index c410cbe801..d2c57664fb 100644
--- a/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/LiteralValueReference.cs
+++ b/main/src/core/Mono.Debugging/Mono.Debugging.Evaluation/LiteralValueReference.cs
@@ -44,6 +44,17 @@ namespace Mono.Debugging.Evaluation
{
}
+ public static LiteralValueReference CreateTargetBaseObjectLiteral (EvaluationContext ctx, string name, object value)
+ {
+ LiteralValueReference val = new LiteralValueReference (ctx);
+ var type = ctx.Adapter.GetValueType (ctx, value);
+ val.name = name;
+ val.value = value;
+ val.type = ctx.Adapter.GetBaseType (ctx, type);
+ val.objCreated = true;
+ return val;
+ }
+
public static LiteralValueReference CreateTargetObjectLiteral (EvaluationContext ctx, string name, object value)
{
LiteralValueReference val = new LiteralValueReference (ctx);
@@ -126,9 +137,35 @@ namespace Mono.Debugging.Evaluation
if (ObjectValue is EvaluationResult) {
EvaluationResult exp = (EvaluationResult) ObjectValue;
return Mono.Debugging.Client.ObjectValue.CreateObject (this, new ObjectPath (Name), "", exp, Flags, null);
- }
- else
+ } else
return base.OnCreateObjectValue (options);
}
+
+ public override ValueReference GetChild (string name, EvaluationOptions options)
+ {
+ object obj = Value;
+
+ if (obj == null)
+ return null;
+
+ if (name [0] == '[' && Context.Adapter.IsArray (Context, obj)) {
+ // Parse the array indices
+ string[] sinds = name.Substring (1, name.Length - 2).Split (',');
+ int[] indices = new int [sinds.Length];
+ for (int n=0; n<sinds.Length; n++)
+ indices [n] = int.Parse (sinds [n]);
+
+ return new ArrayValueReference (Context, obj, indices);
+ }
+
+ if (Context.Adapter.IsClassInstance (Context, obj)) {
+ // Note: This is the only difference with the default ValueReference implementation.
+ // We need this because the user may be requesting a base class's implementation, in
+ // which case 'Type' will be the BaseType instead of the actual type of the variable.
+ return Context.Adapter.GetMember (GetChildrenContext (options), this, Type, obj, name);
+ }
+
+ return null;
+ }
}
}