Browse Source

#2156: Enforce string type of string.to.int argument.

pull/2176/head
Siegfried Pammer 5 years ago
parent
commit
813cd1842f
  1. 7
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs
  2. 7
      ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

7
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -3461,7 +3461,12 @@ namespace ICSharpCode.Decompiler.CSharp @@ -3461,7 +3461,12 @@ namespace ICSharpCode.Decompiler.CSharp
TranslatedExpression value;
if (inst.Value is StringToInt strToInt)
{
value = Translate(strToInt.Argument);
value = Translate(strToInt.Argument)
.ConvertTo(
typeSystem.FindType(KnownTypeCode.String),
this,
allowImplicitConversion: true
);
}
else
{

7
ICSharpCode.Decompiler/CSharp/StatementBuilder.cs

@ -198,7 +198,12 @@ namespace ICSharpCode.Decompiler.CSharp @@ -198,7 +198,12 @@ namespace ICSharpCode.Decompiler.CSharp
TranslatedExpression value;
if (inst.Value is StringToInt strToInt)
{
value = exprBuilder.Translate(strToInt.Argument);
value = exprBuilder.Translate(strToInt.Argument)
.ConvertTo(
typeSystem.FindType(KnownTypeCode.String),
exprBuilder,
allowImplicitConversion: true
);
}
else
{

Loading…
Cancel
Save