diff options
author | chriseth <c@ethdev.com> | 2016-09-05 19:34:57 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-09-06 03:28:28 +0800 |
commit | 1eb7ddbb09b2ff3c65b6329962229ffcc10eaf03 (patch) | |
tree | a7865a77f8f0d78045af256cc5e704acd1311cc6 /libsolidity/analysis | |
parent | 9c64edf11052f2918f10ccd202bbfda628005562 (diff) | |
download | dexon-solidity-1eb7ddbb09b2ff3c65b6329962229ffcc10eaf03.tar dexon-solidity-1eb7ddbb09b2ff3c65b6329962229ffcc10eaf03.tar.gz dexon-solidity-1eb7ddbb09b2ff3c65b6329962229ffcc10eaf03.tar.bz2 dexon-solidity-1eb7ddbb09b2ff3c65b6329962229ffcc10eaf03.tar.lz dexon-solidity-1eb7ddbb09b2ff3c65b6329962229ffcc10eaf03.tar.xz dexon-solidity-1eb7ddbb09b2ff3c65b6329962229ffcc10eaf03.tar.zst dexon-solidity-1eb7ddbb09b2ff3c65b6329962229ffcc10eaf03.zip |
Make constant and payable mutually exclusive.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index c948b90b..eea4619d 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -424,6 +424,8 @@ bool TypeChecker::visit(FunctionDefinition const& _function) if (!_function.isConstructor() && !_function.name().empty() && !_function.isPartOfExternalInterface()) typeError(_function.location(), "Internal functions cannot be payable."); } + if (_function.isPayable() && _function.isDeclaredConst()) + typeError(_function.location(), "Functions cannot be constant and payable at the same time."); for (ASTPointer<VariableDeclaration> const& var: _function.parameters() + _function.returnParameters()) { if (!type(*var)->canLiveOutsideStorage()) |