Browse Source

Avoid unnecessary specialization.

pull/728/head
Daniel Grunwald 10 years ago
parent
commit
7745845192
  1. 2
      ICSharpCode.Decompiler/Tests/TestCases/ValueTypeCall.cs
  2. 4
      ICSharpCode.Decompiler/TypeSystem/SpecializingDecompilerTypeSystem.cs

2
ICSharpCode.Decompiler/Tests/TestCases/ValueTypeCall.cs

@ -9,7 +9,7 @@ namespace ValueTypeCall @@ -9,7 +9,7 @@ namespace ValueTypeCall
public void Increment()
{
Console.WriteLine("Inc() called on {0}", val);
val++;
val = val + 1;
}
}

4
ICSharpCode.Decompiler/TypeSystem/SpecializingDecompilerTypeSystem.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.Decompiler @@ -51,7 +51,7 @@ namespace ICSharpCode.Decompiler
public IField Resolve(Mono.Cecil.FieldReference fieldReference)
{
IField field = context.Resolve(fieldReference);
if (field != null)
if (field != null && field.Substitution != TypeParameterSubstitution.Identity)
field = (IField)field.Specialize(substitution);
return field;
}
@ -59,7 +59,7 @@ namespace ICSharpCode.Decompiler @@ -59,7 +59,7 @@ namespace ICSharpCode.Decompiler
public IMethod Resolve(Mono.Cecil.MethodReference methodReference)
{
IMethod method = context.Resolve(methodReference);
if (method != null)
if (method != null && method.Substitution != TypeParameterSubstitution.Identity)
method = (IMethod)method.Specialize(substitution);
return method;
}

Loading…
Cancel
Save