mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Remove constant/payable in all function types
This commit is contained in:
parent
b225bf5d53
commit
a26a5f20ce
@ -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
|
||||
|
@ -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"
|
||||
|
@ -645,8 +645,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
FunctionType::Kind::BareCall,
|
||||
false,
|
||||
nullptr,
|
||||
false,
|
||||
false,
|
||||
StateMutability::NonPayable,
|
||||
true,
|
||||
true
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user