aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2016-11-09 22:14:16 +0800
committerchriseth <c@ethdev.com>2016-11-16 21:37:18 +0800
commit925d6741466a423b58cb519b6cc400863426607e (patch)
tree1b82670259db05e74277e033cb3a0117e6125dd8 /libsolidity/ast
parentf7a62c1e69e98cc612b7ed98497260b38234a162 (diff)
downloaddexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar
dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.gz
dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.bz2
dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.lz
dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.xz
dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.tar.zst
dexon-solidity-925d6741466a423b58cb519b6cc400863426607e.zip
Disallow payable internal functions.
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/Types.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 395faf55..e18735d9 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -1704,7 +1704,7 @@ TypePointer TupleType::closestTemporaryType(TypePointer const& _targetType) cons
FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal):
m_location(_isInternal ? Location::Internal : Location::External),
m_isConstant(_function.isDeclaredConst()),
- m_isPayable(_function.isPayable()),
+ m_isPayable(_isInternal ? false : _function.isPayable()),
m_declaration(&_function)
{
TypePointers params;
@@ -1810,6 +1810,8 @@ FunctionType::FunctionType(FunctionTypeName const& _typeName):
m_isConstant(_typeName.isDeclaredConst()),
m_isPayable(_typeName.isPayable())
{
+ if (_typeName.isPayable())
+ solAssert(m_location == Location::External, "Internal payable function type used.");
for (auto const& t: _typeName.parameterTypes())
{
solAssert(t->annotation().type, "Type not set for parameter.");