|
|
|
@ -62,7 +62,7 @@ namespace ICSharpCode.Decompiler.Ast
@@ -62,7 +62,7 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
nv.AddExistingName(v.Name); |
|
|
|
|
} else if (v.OriginalVariable != null && context.Settings.UseDebugSymbols) { |
|
|
|
|
string varName = v.OriginalVariable.Name; |
|
|
|
|
if (string.IsNullOrEmpty(varName) || varName.StartsWith("V_", StringComparison.Ordinal) || varName.StartsWith("CS$", StringComparison.Ordinal)) |
|
|
|
|
if (string.IsNullOrEmpty(varName) || varName.StartsWith("V_", StringComparison.Ordinal) || !IsValidName(varName)) |
|
|
|
|
{ |
|
|
|
|
// don't use the name from the debug symbols if it looks like a generated name
|
|
|
|
|
v.Name = null; |
|
|
|
@ -86,6 +86,19 @@ namespace ICSharpCode.Decompiler.Ast
@@ -86,6 +86,19 @@ namespace ICSharpCode.Decompiler.Ast
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static bool IsValidName(string varName) |
|
|
|
|
{ |
|
|
|
|
if (string.IsNullOrEmpty(varName)) |
|
|
|
|
return false; |
|
|
|
|
if (!(char.IsLetter(varName[0]) || varName[0] == '_')) |
|
|
|
|
return false; |
|
|
|
|
for (int i = 1; i < varName.Length; i++) { |
|
|
|
|
if (!(char.IsLetterOrDigit(varName[i]) || varName[i] == '_')) |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DecompilerContext context; |
|
|
|
|
List<string> fieldNamesInCurrentType; |
|
|
|
|
Dictionary<string, int> typeNames = new Dictionary<string, int>(); |
|
|
|
|