mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #665 from axic/feature/accept-ether
BREAKING: Add payable modifier
This commit is contained in:
@@ -242,6 +242,12 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac
|
||||
m_context << notFound;
|
||||
if (fallback)
|
||||
{
|
||||
if (!fallback->isPayable())
|
||||
{
|
||||
// Throw if function is not payable but call contained ether.
|
||||
m_context << Instruction::CALLVALUE;
|
||||
m_context.appendConditionalJumpTo(m_context.errorTag());
|
||||
}
|
||||
eth::AssemblyItem returnTag = m_context.pushNewTag();
|
||||
fallback->accept(*this);
|
||||
m_context << returnTag;
|
||||
@@ -255,7 +261,15 @@ void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contrac
|
||||
FunctionTypePointer const& functionType = it.second;
|
||||
solAssert(functionType->hasDeclaration(), "");
|
||||
CompilerContext::LocationSetter locationSetter(m_context, functionType->declaration());
|
||||
|
||||
m_context << callDataUnpackerEntryPoints.at(it.first);
|
||||
if (!functionType->isPayable())
|
||||
{
|
||||
// Throw if function is not payable but call contained ether.
|
||||
m_context << Instruction::CALLVALUE;
|
||||
m_context.appendConditionalJumpTo(m_context.errorTag());
|
||||
}
|
||||
|
||||
eth::AssemblyItem returnTag = m_context.pushNewTag();
|
||||
m_context << CompilerUtils::dataStartOffset;
|
||||
appendCalldataUnpacker(functionType->parameterTypes());
|
||||
|
||||
@@ -583,6 +583,8 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
Location::Bare,
|
||||
false,
|
||||
nullptr,
|
||||
false,
|
||||
false,
|
||||
true,
|
||||
true
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user