mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support address().codehash
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user