diff options
author | nosami <jasonimison@gmail.com> | 2022-10-19 16:25:50 +0300 |
---|---|---|
committer | nosami <jasonimison@gmail.com> | 2022-10-25 13:44:29 +0300 |
commit | 243cda69906635ff54154d6a4badb47bd6b3363d (patch) | |
tree | 99c103e78083d44106d182e5962e2e893910e0f9 | |
parent | 7491602f5bb39dac5bce685efdb504d2dd7d2dcb (diff) |
More test fixes
3 files changed, 32 insertions, 13 deletions
diff --git a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluator.cs b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluator.cs index 2a08ecf..fd70ed8 100644 --- a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluator.cs +++ b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluator.cs @@ -134,9 +134,6 @@ namespace Mono.Debugging.Evaluation expression = ReplaceExceptionTag (expression, ctx.Options.CurrentExceptionTag); - // Required as a workaround for a bug in the parser (it won't parse simple expressions like numbers) - if (!expression.EndsWith (";", StringComparison.Ordinal)) - expression += ";"; ParseOptions options = new CSharpParseOptions (); var expr = SyntaxFactory.ParseExpression (expression, options: options); diff --git a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs index 22143bb..4f4715a 100644 --- a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs +++ b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExpressionEvaluatorVisitor.cs @@ -852,11 +852,7 @@ namespace Mono.Debugging.Evaluation typeArgs = null; var fullName = invocationExpression.ToString(); var lastIndexOfDot = fullName.LastIndexOf("."); - if(lastIndexOfDot == -1) { - return fullName; - } else { - return fullName.Substring(lastIndexOfDot + 1); - } + return fullName.Substring(lastIndexOfDot + 1); } public override ValueReference VisitInvocationExpression (InvocationExpressionSyntax node) @@ -1214,16 +1210,17 @@ namespace Mono.Debugging.Evaluation } public override ValueReference VisitAliasQualifiedName(AliasQualifiedNameSyntax node) { - return null; - return this.Visit(node.Alias); + //return null; + return this.Visit(node.Name); } public override ValueReference VisitNullableType (NullableTypeSyntax node) { //if(node.) var value = this.Visit(node.ElementType); - var type1 = ctx.Adapter.GetValueType(ctx, value); + var type1 = ctx.Adapter.GetType(ctx, NRefactoryExtensions.Resolve(node.ElementType.ToString())); + //ctx.Adapter. ValueReference nullable = ctx.Adapter.NullableGetValue(ctx, type1, value); return nullable; return this.Visit(node.ElementType); @@ -1231,7 +1228,7 @@ namespace Mono.Debugging.Evaluation public override ValueReference VisitQualifiedName (QualifiedNameSyntax node) { - return base.VisitQualifiedName (node); + return Visit(node.Right); } public override ValueReference DefaultVisit (SyntaxNode node) { diff --git a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExtensions.cs b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExtensions.cs index 74ab215..ebabc02 100644 --- a/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExtensions.cs +++ b/Mono.Debugging/Mono.Debugging.Evaluation/NRefactoryExtensions.cs @@ -149,7 +149,32 @@ namespace Mono.Debugging.Evaluation default: return null; } } - + public static string Resolve (string shortTypeName) + { + string longName = ""; + switch (shortTypeName) { + case "bool": longName = "System.Boolean"; break; + case "byte": longName = "System.Byte"; break; + case "sbyte": longName = "System.SByte"; break; + case "char": longName = "System.Char"; break; + case "decimal": longName = "System.Decimal"; break; + case "double": longName = "System.Double"; break; + case "float": longName = "System.Single"; break; + case "int": longName = "System.Int32"; break; + case "uint": longName = "System.UInt32"; break; + case "nint": longName = "System.IntPtr"; break; + case "nuint": longName = "System.UIntPtr"; break; + case "long": longName = "System.Int64"; break; + case "ulong": longName = "System.UInt64"; break; + case "short": longName = "System.Int16"; break; + case "ushort": longName = "System.UInt16"; break; + case "object": longName = "System.Object"; break; + case "string": longName = "System.String"; break; + case "dynamic": longName = "System.Object"; break; + default: throw new ArgumentException($"Unknown type {shortTypeName}"); + } + return longName; + } static string Resolve (this PredefinedTypeSyntax type, EvaluationContext ctx, List<object> args) { return Resolve (type); |