Browse Source

Fix #1627: Allow constants as targets of dynamic calls.

pull/1633/head
Siegfried Pammer 6 years ago
parent
commit
f49cc11c76
  1. 5
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/DynamicTests.cs
  2. 1
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

5
ICSharpCode.Decompiler.Tests/TestCases/Pretty/DynamicTests.cs

@ -410,6 +410,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -410,6 +410,11 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
}
}
private static bool ConstantTarget(dynamic a)
{
return true.Equals(a);
}
private static dynamic GetDynamic(int i)
{
return null;

1
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -2891,7 +2891,6 @@ namespace ICSharpCode.Decompiler.CSharp @@ -2891,7 +2891,6 @@ namespace ICSharpCode.Decompiler.CSharp
{
Debug.Assert(!argumentInfo.HasFlag(CSharpArgumentInfoFlags.NamedArgument));
Debug.Assert(!argumentInfo.HasFlag(CSharpArgumentInfoFlags.IsOut));
Debug.Assert(!argumentInfo.HasFlag(CSharpArgumentInfoFlags.Constant));
if (argumentInfo.HasFlag(CSharpArgumentInfoFlags.IsStaticType) && IL.Transforms.TransformExpressionTrees.MatchGetTypeFromHandle(inst, out var callTargetType)) {
return new TypeReferenceExpression(ConvertType(callTargetType))

Loading…
Cancel
Save