Browse Source

Revert the 'unwrapBoxingConversion' addition to TranslateTarget(), I ended up solving the boxing issue directly in HandleDelegateConstruction()

pull/1347/head
Daniel Grunwald 7 years ago
parent
commit
e990d5ac00
  1. 2
      ICSharpCode.Decompiler.Tests/TestCases/Correctness/StackTypes.il
  2. 5
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

2
ICSharpCode.Decompiler.Tests/TestCases/Correctness/StackTypes.il

@ -22,7 +22,7 @@ extends [mscorlib]System.Object @@ -22,7 +22,7 @@ extends [mscorlib]System.Object
call void Program::InlineAssignByte()
call void Program::Int32OrNativeTests()
call void Program::ByRefInstanceCallWithTypeMismatchTests()
call void Program::ByRefInstanceCallWithTypeMismatchTests()
ret
} // end of method Main

5
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -1669,7 +1669,7 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1669,7 +1669,7 @@ namespace ICSharpCode.Decompiler.CSharp
}
internal TranslatedExpression TranslateTarget(ILInstruction target, bool nonVirtualInvocation,
bool memberStatic, IType memberDeclaringType, bool unwrapBoxingConversion = false)
bool memberStatic, IType memberDeclaringType)
{
// If references are missing member.IsStatic might not be set correctly.
// Additionally check target for null, in order to avoid a crash.
@ -1680,9 +1680,6 @@ namespace ICSharpCode.Decompiler.CSharp @@ -1680,9 +1680,6 @@ namespace ICSharpCode.Decompiler.CSharp
.WithRR(new ThisResolveResult(memberDeclaringType, nonVirtualInvocation));
} else {
var translatedTarget = Translate(target, memberDeclaringType);
if (unwrapBoxingConversion) {
translatedTarget = ExpressionBuilder.UnwrapBoxingConversion(translatedTarget);
}
if (CallInstruction.ExpectedTypeForThisPointer(memberDeclaringType) == StackType.Ref) {
// When accessing members on value types, ensure we use a reference of the correct type,
// and not a pointer or a reference to a different type (issue #1333)

Loading…
Cancel
Save