aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-08-29 21:24:51 +0800
committerGitHub <noreply@github.com>2017-08-29 21:24:51 +0800
commit93b1cc97022aa01e7daa9816bcc23108bbe008b5 (patch)
tree8ec4eabcaaee6728ac3665c94a4c2f29390bb4aa /libsolidity/ast
parente77e5941202df8363344b6c21a4ba813423ed889 (diff)
parent79e84a8fa43b55838100f9c24dec04b1e721c65c (diff)
downloaddexon-solidity-93b1cc97022aa01e7daa9816bcc23108bbe008b5.tar.gz
dexon-solidity-93b1cc97022aa01e7daa9816bcc23108bbe008b5.tar.zst
dexon-solidity-93b1cc97022aa01e7daa9816bcc23108bbe008b5.zip
Merge pull request #2833 from ethereum/statemutability-builtins
Mark all built in functions with appropriate statemutability
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/Types.cpp17
-rw-r--r--libsolidity/ast/Types.h3
2 files changed, 10 insertions, 10 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 15475034..10424858 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -2169,7 +2169,6 @@ FunctionTypePointer FunctionType::newExpressionType(ContractDefinition const& _c
strings{""},
Kind::Creation,
false,
- nullptr,
stateMutability
);
}
@@ -2421,8 +2420,8 @@ FunctionTypePointer FunctionType::interfaceFunctionType() const
m_returnParameterNames,
m_kind,
m_arbitraryParameters,
- m_declaration,
- m_stateMutability
+ m_stateMutability,
+ m_declaration
);
}
@@ -2449,8 +2448,8 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con
strings(),
Kind::SetValue,
false,
- nullptr,
StateMutability::NonPayable,
+ nullptr,
m_gasSet,
m_valueSet
)
@@ -2466,8 +2465,8 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con
strings(),
Kind::SetGas,
false,
- nullptr,
StateMutability::NonPayable,
+ nullptr,
m_gasSet,
m_valueSet
)
@@ -2574,6 +2573,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 ||
@@ -2602,8 +2603,8 @@ TypePointer FunctionType::copyAndSetGasOrValue(bool _setGas, bool _setValue) con
m_returnParameterNames,
m_kind,
m_arbitraryParameters,
- m_declaration,
m_stateMutability,
+ m_declaration,
m_gasSet || _setGas,
m_valueSet || _setValue,
m_bound
@@ -2651,8 +2652,8 @@ FunctionTypePointer FunctionType::asMemberFunction(bool _inLibrary, bool _bound)
m_returnParameterNames,
kind,
m_arbitraryParameters,
- m_declaration,
m_stateMutability,
+ m_declaration,
m_gasSet,
m_valueSet,
_bound
@@ -2870,7 +2871,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)}
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index 310c34fe..de6dcee9 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -899,7 +899,6 @@ public:
strings(),
_kind,
_arbitraryParameters,
- nullptr,
_stateMutability
)
{
@@ -916,8 +915,8 @@ public:
strings _returnParameterNames = strings(),
Kind _kind = Kind::Internal,
bool _arbitraryParameters = false,
- Declaration const* _declaration = nullptr,
StateMutability _stateMutability = StateMutability::NonPayable,
+ Declaration const* _declaration = nullptr,
bool _gasSet = false,
bool _valueSet = false,
bool _bound = false