Browse Source

Relax ExpressionBuilder invariant for lifted instructions with unknown result type.

release/6.2
Daniel Grunwald 5 years ago
parent
commit
103a6461e4
  1. 3
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

3
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -166,6 +166,8 @@ namespace ICSharpCode.Decompiler.CSharp
Debug.Assert(cexpr.Type.GetSign() != Sign.None, "Must have a sign specified for zero/sign-extension"); Debug.Assert(cexpr.Type.GetSign() != Sign.None, "Must have a sign specified for zero/sign-extension");
} }
else if (inst is ILiftableInstruction liftable && liftable.IsLifted) else if (inst is ILiftableInstruction liftable && liftable.IsLifted)
{
if (liftable.UnderlyingResultType != StackType.Unknown)
{ {
Debug.Assert(NullableType.IsNullable(cexpr.Type)); Debug.Assert(NullableType.IsNullable(cexpr.Type));
IType underlying = NullableType.GetUnderlyingType(cexpr.Type); IType underlying = NullableType.GetUnderlyingType(cexpr.Type);
@ -179,6 +181,7 @@ namespace ICSharpCode.Decompiler.CSharp
Debug.Assert(underlying.GetStackType() == liftable.UnderlyingResultType); Debug.Assert(underlying.GetStackType() == liftable.UnderlyingResultType);
} }
} }
}
else if (inst.ResultType == StackType.Ref) else if (inst.ResultType == StackType.Ref)
{ {
Debug.Assert(cexpr.Type.GetStackType() == StackType.Ref || cexpr.Type.GetStackType().IsIntegerType()); Debug.Assert(cexpr.Type.GetStackType() == StackType.Ref || cexpr.Type.GetStackType().IsIntegerType());

Loading…
Cancel
Save