Mark all built in functions with appropriate statemutability

This commit is contained in:
Alex Beregszaszi
2017-08-28 19:43:35 +01:00
parent 3d228e98f1
commit aa94000a91
3 changed files with 17 additions and 12 deletions
+3 -1
View File
@@ -2569,6 +2569,8 @@ u256 FunctionType::externalIdentifier() const
bool FunctionType::isPure() const
{
// FIXME: replace this with m_stateMutability == StateMutability::Pure once
// the callgraph analyzer is in place
return
m_kind == Kind::SHA3 ||
m_kind == Kind::ECRecover ||
@@ -2865,7 +2867,7 @@ MemberList::MemberMap MagicType::nativeMembers(ContractDefinition const*) const
return MemberList::MemberMap({
{"coinbase", make_shared<IntegerType>(0, IntegerType::Modifier::Address)},
{"timestamp", make_shared<IntegerType>(256)},
{"blockhash", make_shared<FunctionType>(strings{"uint"}, strings{"bytes32"}, FunctionType::Kind::BlockHash)},
{"blockhash", make_shared<FunctionType>(strings{"uint"}, strings{"bytes32"}, FunctionType::Kind::BlockHash, false, StateMutability::View)},
{"difficulty", make_shared<IntegerType>(256)},
{"number", make_shared<IntegerType>(256)},
{"gaslimit", make_shared<IntegerType>(256)}