From 64c70936bf0fa2a83ec0c2a85851e0d187fb451e Mon Sep 17 00:00:00 2001 From: Jb Evain Date: Thu, 21 Jul 2016 11:20:41 -0700 Subject: Make AssertCode use the new TryGetName for variables --- Test/Mono.Cecil.Tests/Formatter.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Test/Mono.Cecil.Tests/Formatter.cs b/Test/Mono.Cecil.Tests/Formatter.cs index 7c8c76a..1af56df 100644 --- a/Test/Mono.Cecil.Tests/Formatter.cs +++ b/Test/Mono.Cecil.Tests/Formatter.cs @@ -63,10 +63,9 @@ namespace Mono.Cecil.Tests { static string GetVariableName (VariableDefinition variable, MethodBody body) { - foreach (var scope in body.Method.DebugInformation.GetScopes ()) - foreach (var variable_symbol in scope.Variables) - if (variable_symbol.Index == variable.Index) - return variable_symbol.Name; + string name; + if (body.Method.DebugInformation.TryGetName (variable, out name)) + return name; return variable.ToString (); } -- cgit v1.2.3