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

github.com/mono/debugger-libs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornosami <jasonimison@gmail.com>2022-10-23 20:51:40 +0300
committernosami <jasonimison@gmail.com>2022-10-25 13:44:29 +0300
commit18f9d5d2c3aef5961a6e90eb570e1c6bf808d4ff (patch)
treef67913a5d4376211e7709a850f983bb58d4f8778
parent36c4d5c5f6139c9f09fc21e3d46b6258037ae3d3 (diff)
More Generics evaluation fixes
-rw-r--r--Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs41
-rw-r--r--Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs11
2 files changed, 38 insertions, 14 deletions
diff --git a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs
index fdb3ba1..e0387b1 100644
--- a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs
+++ b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs
@@ -1292,18 +1292,19 @@ namespace Mono.Debugging.Evaluation
public override ValueReference VisitGenericName (GenericNameSyntax node)
{
- object[] typeArgs = new object[node.TypeArgumentList.Arguments.Count];
+ object [] typeArgs = new object [node.TypeArgumentList.Arguments.Count];
for (var i = 0; i < node.TypeArgumentList.Arguments.Count; i++) {
- var typeArg = Visit(node.TypeArgumentList.Arguments[i]);
- typeArgs[i] = typeArg.Type;
+ var typeArg = Visit (node.TypeArgumentList.Arguments [i]);
+ typeArgs [i] = typeArg.Type;
}
- string typeName = node.Identifier.ValueText;
+ string typeName = node.Identifier.ValueText;
- var d = ctx.Adapter.GetDisplayTypeName(typeName);
- var type1 = ctx.Adapter.GetType(ctx, typeName, typeArgs);
- return new TypeValueReference(ctx, type1);
+ typeName = MakeGenericTypeName (node, typeName);
+
+ var type1 = ctx.Adapter.GetType (ctx, typeName, typeArgs);
+ return new TypeValueReference (ctx, type1);
//node.
//object[] typeArgs;
@@ -1331,14 +1332,28 @@ namespace Mono.Debugging.Evaluation
//return LiteralValueReference.CreateTargetObjectLiteral(ctx, expression, ctx.Adapter.CreateValue(ctx, type.Type, args.ToArray()));
}
- //public override ValueReference VisitQualifiedName (QualifiedNameSyntax node)
- //{
- // return Visit(node.Right);
- //}
+
+ private static string MakeGenericTypeName (GenericNameSyntax node, string typeName)
+ {
+ if (node.Parent is QualifiedNameSyntax qns && qns.Left is IdentifierNameSyntax ins)
+ return $"{ins.Identifier.Value}.{typeName}`{node.TypeArgumentList.Arguments.Count}";
+
+ if (node.Parent is QualifiedNameSyntax qns2 && qns2.Left is QualifiedNameSyntax left)
+ return $"{left}.{typeName}`{node.TypeArgumentList.Arguments.Count}";
+ return typeName;
+ }
+
+ public override ValueReference VisitQualifiedName(QualifiedNameSyntax node)
+ {
+ if(node.Right is GenericNameSyntax) {
+ return Visit(node.Right);
+ }
+ var type1 = ctx.Adapter.GetType(ctx, node.ToString());
+ return new TypeValueReference(ctx, type1);
+ }
+
public override ValueReference DefaultVisit (SyntaxNode node)
{
- if(node is GenericNameSyntax gns)
- Console.WriteLine("o");
if (node is LiteralExpressionSyntax syntax)
{
return LiteralValueReference.CreateObjectLiteral(ctx, expression, syntax.Token.Value);
diff --git a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs
index 98d4a58..db83347 100644
--- a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs
+++ b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionResolverVisitor.cs
@@ -107,7 +107,7 @@ namespace Mono.Debugging.Evaluation
if (memberType) {
type = type.Substring (type.LastIndexOf ('.') + 1);
} else {
- type = "global::" + type;
+ //type = "global::" + type;
}
parentType = type + GenerateGenericArgs (genericArgs);
@@ -142,5 +142,14 @@ namespace Mono.Debugging.Evaluation
{
ReplaceType (node);
}
+
+ public override void VisitGenericName(GenericNameSyntax node)
+ {
+ var loc = node.Identifier.GetLocation();
+ int length = loc.SourceSpan.Length;
+ int offset = loc.SourceSpan.Start;
+
+ ReplaceType(node.Identifier.Text, node.TypeArgumentList.Arguments.Count, offset, length);
+ }
}
} \ No newline at end of file