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())
|
if (isAddress())
|
||||||
return {
|
return {
|
||||||
{"balance", make_shared<IntegerType >(256)},
|
{"balance", make_shared<IntegerType >(256)},
|
||||||
{"call", make_shared<FunctionType>(strings(), strings{"bool"}, FunctionType::Kind::BareCall, 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, false, true)},
|
{"callcode", make_shared<FunctionType>(strings(), strings{"bool"}, FunctionType::Kind::BareCallCode, true, StateMutability::Payable)},
|
||||||
{"delegatecall", make_shared<FunctionType>(strings(), strings{"bool"}, FunctionType::Kind::BareDelegateCall, true)},
|
{"delegatecall", make_shared<FunctionType>(strings(), strings{"bool"}, FunctionType::Kind::BareDelegateCall, true)},
|
||||||
{"send", make_shared<FunctionType>(strings{"uint"}, strings{"bool"}, FunctionType::Kind::Send)},
|
{"send", make_shared<FunctionType>(strings{"uint"}, strings{"bool"}, FunctionType::Kind::Send)},
|
||||||
{"transfer", make_shared<FunctionType>(strings{"uint"}, strings(), FunctionType::Kind::Transfer)}
|
{"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();
|
FunctionDefinition const* constructor = _contract.constructor();
|
||||||
TypePointers parameters;
|
TypePointers parameters;
|
||||||
strings parameterNames;
|
strings parameterNames;
|
||||||
bool payable = false;
|
StateMutability stateMutability = StateMutability::NonPayable;
|
||||||
|
|
||||||
if (constructor)
|
if (constructor)
|
||||||
{
|
{
|
||||||
@ -2149,7 +2149,8 @@ FunctionTypePointer FunctionType::newExpressionType(ContractDefinition const& _c
|
|||||||
parameterNames.push_back(var->name());
|
parameterNames.push_back(var->name());
|
||||||
parameters.push_back(var->annotation().type);
|
parameters.push_back(var->annotation().type);
|
||||||
}
|
}
|
||||||
payable = constructor->isPayable();
|
if (constructor->isPayable())
|
||||||
|
stateMutability = StateMutability::Payable;
|
||||||
}
|
}
|
||||||
return make_shared<FunctionType>(
|
return make_shared<FunctionType>(
|
||||||
parameters,
|
parameters,
|
||||||
@ -2159,8 +2160,7 @@ FunctionTypePointer FunctionType::newExpressionType(ContractDefinition const& _c
|
|||||||
Kind::Creation,
|
Kind::Creation,
|
||||||
false,
|
false,
|
||||||
nullptr,
|
nullptr,
|
||||||
false,
|
stateMutability
|
||||||
payable
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2418,8 +2418,7 @@ FunctionTypePointer FunctionType::interfaceFunctionType() const
|
|||||||
m_kind,
|
m_kind,
|
||||||
m_arbitraryParameters,
|
m_arbitraryParameters,
|
||||||
m_declaration,
|
m_declaration,
|
||||||
isConstant(),
|
m_stateMutability
|
||||||
isPayable()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2447,8 +2446,7 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con
|
|||||||
Kind::SetValue,
|
Kind::SetValue,
|
||||||
false,
|
false,
|
||||||
nullptr,
|
nullptr,
|
||||||
false,
|
StateMutability::NonPayable,
|
||||||
false,
|
|
||||||
m_gasSet,
|
m_gasSet,
|
||||||
m_valueSet
|
m_valueSet
|
||||||
)
|
)
|
||||||
@ -2465,8 +2463,7 @@ MemberList::MemberMap FunctionType::nativeMembers(ContractDefinition const*) con
|
|||||||
Kind::SetGas,
|
Kind::SetGas,
|
||||||
false,
|
false,
|
||||||
nullptr,
|
nullptr,
|
||||||
false,
|
StateMutability::NonPayable,
|
||||||
false,
|
|
||||||
m_gasSet,
|
m_gasSet,
|
||||||
m_valueSet
|
m_valueSet
|
||||||
)
|
)
|
||||||
@ -2602,8 +2599,7 @@ TypePointer FunctionType::copyAndSetGasOrValue(bool _setGas, bool _setValue) con
|
|||||||
m_kind,
|
m_kind,
|
||||||
m_arbitraryParameters,
|
m_arbitraryParameters,
|
||||||
m_declaration,
|
m_declaration,
|
||||||
isConstant(),
|
m_stateMutability,
|
||||||
isPayable(),
|
|
||||||
m_gasSet || _setGas,
|
m_gasSet || _setGas,
|
||||||
m_valueSet || _setValue,
|
m_valueSet || _setValue,
|
||||||
m_bound
|
m_bound
|
||||||
@ -2652,8 +2648,7 @@ FunctionTypePointer FunctionType::asMemberFunction(bool _inLibrary, bool _bound)
|
|||||||
kind,
|
kind,
|
||||||
m_arbitraryParameters,
|
m_arbitraryParameters,
|
||||||
m_declaration,
|
m_declaration,
|
||||||
isConstant(),
|
m_stateMutability,
|
||||||
isPayable(),
|
|
||||||
m_gasSet,
|
m_gasSet,
|
||||||
m_valueSet,
|
m_valueSet,
|
||||||
_bound
|
_bound
|
||||||
|
@ -890,8 +890,7 @@ public:
|
|||||||
strings const& _returnParameterTypes,
|
strings const& _returnParameterTypes,
|
||||||
Kind _kind = Kind::Internal,
|
Kind _kind = Kind::Internal,
|
||||||
bool _arbitraryParameters = false,
|
bool _arbitraryParameters = false,
|
||||||
bool _constant = false,
|
StateMutability _stateMutability = StateMutability::NonPayable
|
||||||
bool _payable = false
|
|
||||||
): FunctionType(
|
): FunctionType(
|
||||||
parseElementaryTypeVector(_parameterTypes),
|
parseElementaryTypeVector(_parameterTypes),
|
||||||
parseElementaryTypeVector(_returnParameterTypes),
|
parseElementaryTypeVector(_returnParameterTypes),
|
||||||
@ -900,8 +899,7 @@ public:
|
|||||||
_kind,
|
_kind,
|
||||||
_arbitraryParameters,
|
_arbitraryParameters,
|
||||||
nullptr,
|
nullptr,
|
||||||
_constant,
|
_stateMutability
|
||||||
_payable
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -918,8 +916,7 @@ public:
|
|||||||
Kind _kind = Kind::Internal,
|
Kind _kind = Kind::Internal,
|
||||||
bool _arbitraryParameters = false,
|
bool _arbitraryParameters = false,
|
||||||
Declaration const* _declaration = nullptr,
|
Declaration const* _declaration = nullptr,
|
||||||
bool _isConstant = false,
|
StateMutability _stateMutability = StateMutability::NonPayable,
|
||||||
bool _isPayable = false,
|
|
||||||
bool _gasSet = false,
|
bool _gasSet = false,
|
||||||
bool _valueSet = false,
|
bool _valueSet = false,
|
||||||
bool _bound = false
|
bool _bound = false
|
||||||
@ -929,19 +926,13 @@ public:
|
|||||||
m_parameterNames(_parameterNames),
|
m_parameterNames(_parameterNames),
|
||||||
m_returnParameterNames(_returnParameterNames),
|
m_returnParameterNames(_returnParameterNames),
|
||||||
m_kind(_kind),
|
m_kind(_kind),
|
||||||
|
m_stateMutability(_stateMutability),
|
||||||
m_arbitraryParameters(_arbitraryParameters),
|
m_arbitraryParameters(_arbitraryParameters),
|
||||||
m_gasSet(_gasSet),
|
m_gasSet(_gasSet),
|
||||||
m_valueSet(_valueSet),
|
m_valueSet(_valueSet),
|
||||||
m_bound(_bound),
|
m_bound(_bound),
|
||||||
m_declaration(_declaration)
|
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(
|
solAssert(
|
||||||
!m_bound || !m_parameterTypes.empty(),
|
!m_bound || !m_parameterTypes.empty(),
|
||||||
"Attempted construction of bound function without self type"
|
"Attempted construction of bound function without self type"
|
||||||
|
@ -645,8 +645,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
|||||||
FunctionType::Kind::BareCall,
|
FunctionType::Kind::BareCall,
|
||||||
false,
|
false,
|
||||||
nullptr,
|
nullptr,
|
||||||
false,
|
StateMutability::NonPayable,
|
||||||
false,
|
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user