|
|
|
@ -1432,6 +1432,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -1432,6 +1432,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
|
|
|
|
|
TypeCode code = ReflectionHelper.GetTypeCode(underlyingType); |
|
|
|
|
if (code >= TypeCode.Boolean && code <= TypeCode.Decimal && expression.ConstantValue != null) |
|
|
|
|
{ |
|
|
|
|
if (expression.ConstantValue is string) |
|
|
|
|
{ |
|
|
|
|
return new ErrorResolveResult(targetType); |
|
|
|
|
} |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
return new ConstantResolveResult(targetType, CSharpPrimitiveCast(code, expression.ConstantValue)); |
|
|
|
@ -1454,6 +1458,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
@@ -1454,6 +1458,10 @@ namespace ICSharpCode.Decompiler.CSharp.Resolver
|
|
|
|
|
} |
|
|
|
|
else if ((underlyingType.Kind == TypeKind.NInt || underlyingType.Kind == TypeKind.NUInt) && expression.ConstantValue != null) |
|
|
|
|
{ |
|
|
|
|
if (expression.ConstantValue is string) |
|
|
|
|
{ |
|
|
|
|
return new ErrorResolveResult(targetType); |
|
|
|
|
} |
|
|
|
|
code = (underlyingType.Kind == TypeKind.NInt ? TypeCode.Int32 : TypeCode.UInt32); |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|