Browse Source

ExpressionBuilder: Use TSAB.ConvertConstantValue in VisitLdcF4 and VisitLdcF8

pull/1350/head
Siegfried Pammer 7 years ago
parent
commit
d1ef913fc0
  1. 10
      ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

10
ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs

@ -435,16 +435,14 @@ namespace ICSharpCode.Decompiler.CSharp @@ -435,16 +435,14 @@ namespace ICSharpCode.Decompiler.CSharp
protected internal override TranslatedExpression VisitLdcF4(LdcF4 inst, TranslationContext context)
{
return new PrimitiveExpression(inst.Value)
.WithILInstruction(inst)
.WithRR(new ConstantResolveResult(compilation.FindType(KnownTypeCode.Single), inst.Value));
var expr = astBuilder.ConvertConstantValue(compilation.FindType(KnownTypeCode.Single), inst.Value);
return new TranslatedExpression(expr.WithILInstruction(inst));
}
protected internal override TranslatedExpression VisitLdcF8(LdcF8 inst, TranslationContext context)
{
return new PrimitiveExpression(inst.Value)
.WithILInstruction(inst)
.WithRR(new ConstantResolveResult(compilation.FindType(KnownTypeCode.Double), inst.Value));
var expr = astBuilder.ConvertConstantValue(compilation.FindType(KnownTypeCode.Double), inst.Value);
return new TranslatedExpression(expr.WithILInstruction(inst));
}
protected internal override TranslatedExpression VisitLdcDecimal(LdcDecimal inst, TranslationContext context)

Loading…
Cancel
Save