Browse Source

Add comments about expected result after a ConvertTo() call.

This method has grown a few cases where it doesn't actually convert.
pull/1600/head
Daniel Grunwald 6 years ago
parent
commit
903544598a
  1. 11
      ICSharpCode.Decompiler/CSharp/TranslatedExpression.cs

11
ICSharpCode.Decompiler/CSharp/TranslatedExpression.cs

@ -176,6 +176,17 @@ namespace ICSharpCode.Decompiler.CSharp @@ -176,6 +176,17 @@ namespace ICSharpCode.Decompiler.CSharp
///
/// From the caller's perspective, IntPtr/UIntPtr behave like normal C# integers except that they have native int size.
/// All the special cases necessary to make IntPtr/UIntPtr behave sanely are handled internally in ConvertTo().
///
/// Post-condition:
/// The "expected evaluation result" is the value computed by <c>this.Expression</c>,
/// converted to targetType via an IL conv instruction.
///
/// ConvertTo(targetType, allowImplicitConversion=false).Type must be equal to targetType (modulo identity conversions).
/// The value computed by the converted expression must match the "expected evaluation result".
///
/// ConvertTo(targetType, allowImplicitConversion=true) must produce an expression that,
/// when evaluated in a context where it will be implicitly converted to targetType,
/// evaluates to the "expected evaluation result".
/// </remarks>
public TranslatedExpression ConvertTo(IType targetType, ExpressionBuilder expressionBuilder, bool checkForOverflow = false, bool allowImplicitConversion = false)
{

Loading…
Cancel
Save