Support address().codehash

This commit is contained in:
Alex Beregszaszi
2020-12-09 14:58:27 +00:00
parent fca8026250
commit ad6739d0f6
12 changed files with 83 additions and 4 deletions
+11
View File
@@ -2924,6 +2924,17 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
annotation.isPure = true;
}
if (
_memberAccess.expression().annotation().type->category() == Type::Category::Address &&
memberName == "codehash" &&
!m_evmVersion.hasExtCodeHash()
)
m_errorReporter.typeError(
7598_error,
_memberAccess.location(),
"\"codehash\" is not supported by the VM version."
);
if (!annotation.isPure.set())
annotation.isPure = false;
+1 -1
View File
@@ -356,7 +356,7 @@ void ViewPureChecker::endVisit(MemberAccess const& _memberAccess)
switch (_memberAccess.expression().annotation().type->category())
{
case Type::Category::Address:
if (member == "balance")
if (member == "balance" || member == "codehash")
mutability = StateMutability::View;
break;
case Type::Category::Magic: