Browse Source

#1922: Fix hexadecimal integer literals missing the `uL` suffix.

pull/1930/head
Daniel Grunwald 6 years ago
parent
commit
8d780cc921
  1. 6
      ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

6
ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs

@ -787,6 +787,12 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
string literalValue = null; string literalValue = null;
if (PrintIntegralValuesAsHex) { if (PrintIntegralValuesAsHex) {
literalValue = $"0x{constantValue:X}"; literalValue = $"0x{constantValue:X}";
if (constantValue is uint || constantValue is ulong) {
literalValue += "u";
}
if (constantValue is long || constantValue is ulong) {
literalValue += "L";
}
} }
expr = new PrimitiveExpression(constantValue, literalValue); expr = new PrimitiveExpression(constantValue, literalValue);
if (AddResolveResultAnnotations) if (AddResolveResultAnnotations)

Loading…
Cancel
Save