Added a type annotation (esp. for signed types) for hex literals in the C/C++ backends

This commit is contained in:
Neil Brown 2008-02-27 14:00:54 +00:00
parent 245e4536bc
commit 9712df4458

View File

@ -479,8 +479,13 @@ cgenLiteralRepr (A.IntLiteral m s) t
= do genDecimal s
genLitSuffix t
cgenLiteralRepr (A.HexLiteral m s) t
= do tell ["0x", s]
= do f <- fget getScalarType
ct <- case f t of
Just ct -> return ct
Nothing -> diePC m $ formatCode "Non-scalar type for hex literal: " t
tell ["((",ct,")0x", s]
genLitSuffix t
tell [")"]
cgenLiteralRepr (A.ByteLiteral m s) _ = tell ["'"] >> genByteLiteral s >> tell ["'"]
cgenLiteralRepr (A.ArrayLiteral m aes) _
= do genLeftB