Skip to content

Commit b22c14e

Browse files
committed
apply review feedback
1 parent 14df982 commit b22c14e

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

libyul/AsmJsonImporter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ Literal AsmJsonImporter::createLiteral(Json const& _node)
207207
// import only for inline assembly, no unlimited string literals there
208208
lit.value = valueOfLiteral(value, lit.kind, false /* _unlimitedLiteralArgument */);
209209

210+
yulAssert(validLiteral(lit));
210211
return lit;
211212
}
212213

libyul/Utilities.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,18 @@ bool solidity::yul::validNumberLiteral(solidity::yul::Literal const& _literal)
180180
if (!_literal.value.hint())
181181
return true;
182182

183-
auto const repr = *_literal.value.hint();
184-
return (isValidDecimal(repr) || isValidHex(repr)) && bigint(repr) <= u256(-1);
183+
auto const& repr = *_literal.value.hint();
184+
185+
if (!isValidDecimal(repr) && !isValidHex(repr))
186+
return false;
187+
188+
if (bigint(repr) > u256(-1))
189+
return false;
190+
191+
if (_literal.value.value() != valueOfLiteral(*_literal.value.hint(), _literal.kind).value())
192+
return false;
193+
194+
return true;
185195
}
186196

187197
bool solidity::yul::validBoolLiteral(solidity::yul::Literal const& _literal)

libyul/optimiser/BlockHasher.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ void ExpressionHasher::operator()(Literal const& _literal)
210210
hash64(std::hash<std::string>{}(_literal.value.builtinStringLiteralValue()));
211211
hash64(_literal.type.hash());
212212
hash8(static_cast<uint8_t>(_literal.kind));
213+
hash8(_literal.value.unlimited());
213214
}
214215

215216
void ExpressionHasher::operator()(Identifier const& _identifier)

libyul/optimiser/ForLoopConditionIntoBody.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void ForLoopConditionIntoBody::operator()(ForLoop& _forLoop)
5858
Literal {
5959
debugData,
6060
LiteralKind::Boolean,
61-
LiteralValue{true, "true"},
61+
LiteralValue{true},
6262
m_dialect.boolType
6363
}
6464
);

0 commit comments

Comments
 (0)