implemented type(X).min and type(X).max for all integer types

This commit is contained in:
Harikrishnan Mulackal
2020-05-11 14:51:13 +05:30
parent 4c1e821e01
commit e54c4eecfc
13 changed files with 626 additions and 29 deletions
@@ -1591,6 +1591,16 @@ bool ExpressionCompiler::visit(MemberAccess const& _memberAccess)
result ^= fromBigEndian<uint64_t>(function.first.ref());
m_context << (u256{result} << (256 - 32));
}
else if (member == "min" || member == "max")
{
MagicType const* arg = dynamic_cast<MagicType const*>(_memberAccess.expression().annotation().type);
IntegerType const* integerType = dynamic_cast<IntegerType const*>(arg->typeArgument());
if (member == "min")
m_context << integerType->min();
else
m_context << integerType->max();
}
else if ((set<string>{"encode", "encodePacked", "encodeWithSelector", "encodeWithSignature", "decode"}).count(member))
{
// no-op