diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-10 04:52:25 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-14 21:21:47 +0800 |
commit | a26a5f20ce46800f8deff5724b5c101bb9b5fc1d (patch) | |
tree | 345679632d47ede35d47a799146e76e43afe7297 /libsolidity/ast | |
parent | b225bf5d5364d72d75fab4a6843df665da28b842 (diff) | |
download | dexon-solidity-a26a5f20ce46800f8deff5724b5c101bb9b5fc1d.tar.gz dexon-solidity-a26a5f20ce46800f8deff5724b5c101bb9b5fc1d.tar.zst dexon-solidity-a26a5f20ce46800f8deff5724b5c101bb9b5fc1d.zip |
Remove constant/payable in all function types
Diffstat (limited to 'libsolidity/ast')
-rw-r--r-- | libsolidity/ast/Types.cpp | 27 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 17 |
2 files changed, 15 insertions, 29 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 35dddebb..6c2e55f6 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -477,8 +477,8 @@ MemberList::MemberMap IntegerType::nativeMembers(ContractDefinition const*) cons if (isAddress()) return { {"balance", make_shared<IntegerType >(256)}, - {"call", make_shared<FunctionType>(strings(), strings{"bool"}, FunctionType::Kind::BareCall, true, false, true)}, - {"callcode", make_shared<FunctionType>(strings(), strings{"bool"}, FunctionType::Kind::BareCallCode, true, false, true)}, + {"call", make_shared<FunctionType>(strings(), strings{"bool"}, FunctionType::Kind::BareCall, true, StateMutability::Payable)}, + {"callcode", make_shared<FunctionType>(strings(), strings{"bool"}, FunctionType::Kind::BareCallCode, true, StateMutability::Payable)}, {"delegatecall", make_shared<FunctionType>(strings(), strings{"bool"}, FunctionType::Kind::BareDelegateCall, true)}, {"send", make_shared<FunctionType>(strings{"uint"}, strings{"bool"}, FunctionType::Kind::Send)}, {"transfer", make_shared<FunctionType>(strings{"uint"}, strings(), FunctionType::Kind::Transfer)} @@ -2140,7 +2140,7 @@ FunctionTypePointer FunctionType::newExpressionType(ContractDefinition const& _c FunctionDefinition const* constructor = _contract.constructor(); TypePointers parameters; strings parameterNames; - bool payable = false; + StateMutability stateMutability = StateMutability::NonPayable; if (constructor) { @@ -2149,7 +2149,8 @@ FunctionTypePointer FunctionType::newExpressionType(ContractDefinition const& _c parameterNames.push_back(var->name()); parameters.push_back(var->annotation().type); } - payable = constructor->isPayable(); + if (constructor->isPayable()) + stateMutability = StateMutability::Payable; } return make_shared<FunctionType>( parameters, @@ -2159,8 +2160,7 @@ FunctionTypePointer FunctionType::newExpressionType(ContractDefinition const& _c Kind::Creation, false, nullptr, - false, - payable + stateMutability ); } @@ -2418,8 +2418,7 @@ FunctionTypePointer FunctionType::interfaceFunctionType() const m_kind, m_arbitraryParameters, m_declaration, - isConstant(), - isPayable() + m_stateMutability ); } @@ -2447,8 +2446,7 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con Kind::SetValue, false, nullptr, - false, - false, + StateMutability::NonPayable, m_gasSet, m_valueSet ) @@ -2465,8 +2463,7 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con Kind::SetGas, false, nullptr, - false, - false, + StateMutability::NonPayable, m_gasSet, m_valueSet ) @@ -2602,8 +2599,7 @@ TypePointer FunctionType::copyAndSetGasOrValue(bool _setGas, bool _setValue) con m_kind, m_arbitraryParameters, m_declaration, - isConstant(), - isPayable(), + m_stateMutability, m_gasSet || _setGas, m_valueSet || _setValue, m_bound @@ -2652,8 +2648,7 @@ FunctionTypePointer FunctionType::asMemberFunction(bool _inLibrary, bool _bound) kind, m_arbitraryParameters, m_declaration, - isConstant(), - isPayable(), + m_stateMutability, m_gasSet, m_valueSet, _bound diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 64b07e4e..56546a82 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -890,8 +890,7 @@ public: strings const& _returnParameterTypes, Kind _kind = Kind::Internal, bool _arbitraryParameters = false, - bool _constant = false, - bool _payable = false + StateMutability _stateMutability = StateMutability::NonPayable ): FunctionType( parseElementaryTypeVector(_parameterTypes), parseElementaryTypeVector(_returnParameterTypes), @@ -900,8 +899,7 @@ public: _kind, _arbitraryParameters, nullptr, - _constant, - _payable + _stateMutability ) { } @@ -918,8 +916,7 @@ public: Kind _kind = Kind::Internal, bool _arbitraryParameters = false, Declaration const* _declaration = nullptr, - bool _isConstant = false, - bool _isPayable = false, + StateMutability _stateMutability = StateMutability::NonPayable, bool _gasSet = false, bool _valueSet = false, bool _bound = false @@ -929,19 +926,13 @@ public: m_parameterNames(_parameterNames), m_returnParameterNames(_returnParameterNames), m_kind(_kind), + m_stateMutability(_stateMutability), m_arbitraryParameters(_arbitraryParameters), m_gasSet(_gasSet), m_valueSet(_valueSet), m_bound(_bound), m_declaration(_declaration) { - solAssert(!(_isConstant && _isPayable), ""); - if (_isPayable) - m_stateMutability = StateMutability::Payable; - else if (_isConstant) - m_stateMutability = StateMutability::View; - else - m_stateMutability = StateMutability::NonPayable; solAssert( !m_bound || !m_parameterTypes.empty(), "Attempted construction of bound function without self type" |