Browse Source

Extend MatchLdLocRef to work with type parameters as well.

pull/877/head
Siegfried Pammer 8 years ago
parent
commit
6172dd5bff
  1. 7
      ICSharpCode.Decompiler/IL/Instructions/PatternMatching.cs

7
ICSharpCode.Decompiler/IL/Instructions/PatternMatching.cs

@ -58,10 +58,7 @@ namespace ICSharpCode.Decompiler.IL @@ -58,10 +58,7 @@ namespace ICSharpCode.Decompiler.IL
/// </summary>
public bool MatchLdLocRef(ILVariable variable)
{
if (variable.Type.IsReferenceType == true)
return MatchLdLoc(variable);
else
return MatchLdLoca(variable);
return MatchLdLocRef(out var v) && v == variable;
}
/// <summary>
@ -75,7 +72,7 @@ namespace ICSharpCode.Decompiler.IL @@ -75,7 +72,7 @@ namespace ICSharpCode.Decompiler.IL
return variable.Type.IsReferenceType == true;
case LdLoca ldloca:
variable = ldloca.Variable;
return variable.Type.IsReferenceType != true;
return variable.Type.IsReferenceType != true || variable.Type.Kind == TypeKind.TypeParameter;
default:
variable = null;
return false;

Loading…
Cancel
Save