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

Loading…
Cancel
Save