Hash number literals according to their value instead of their string representation.

This commit is contained in:
chriseth
2022-11-08 20:34:10 +01:00
parent 19fc395662
commit cffacac9de
8 changed files with 32 additions and 11 deletions
+4 -1
View File
@@ -54,7 +54,10 @@ std::map<Block const*, uint64_t> BlockHasher::run(Block const& _block)
void BlockHasher::operator()(Literal const& _literal)
{
hash64(compileTimeLiteralHash("Literal"));
hash64(_literal.value.hash());
if (_literal.kind == LiteralKind::Number)
hash64(std::hash<u256>{}(valueOfNumberLiteral(_literal)));
else
hash64(_literal.value.hash());
hash64(_literal.type.hash());
hash8(static_cast<uint8_t>(_literal.kind));
}