aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2016-08-27 02:37:10 +0800
committerchriseth <c@ethdev.com>2016-09-06 03:28:28 +0800
commit962531af96a8a3ed6b28462d43c69d78fa48d511 (patch)
tree596929bcbcc12d93597067057edb3311de88af5a /libsolidity/analysis
parent680b83b2a44a8f943d6d78028ad4326f4b3b64c2 (diff)
downloaddexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar.gz
dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.tar.zst
dexon-solidity-962531af96a8a3ed6b28462d43c69d78fa48d511.zip
Merged in changes from chriseth/payable
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index bc03da01..c1781397 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -272,6 +272,7 @@ void TypeChecker::checkContractIllegalOverrides(ContractDefinition const& _contr
if (
overriding->visibility() != function->visibility() ||
overriding->isDeclaredConst() != function->isDeclaredConst() ||
+ overriding->isPayable() != function->isPayable() ||
overridingType != functionType
)
typeError(overriding->location(), "Override changes extended function signature.");
@@ -416,6 +417,13 @@ bool TypeChecker::visit(StructDefinition const& _struct)
bool TypeChecker::visit(FunctionDefinition const& _function)
{
bool isLibraryFunction = dynamic_cast<ContractDefinition const&>(*_function.scope()).isLibrary();
+ if (_function.isPayable())
+ {
+ if (isLibraryFunction)
+ typeError(_function.location(), "Library functions cannot be payable.");
+ if (!_function.isConstructor() && !_function.name().empty() && !_function.isPartOfExternalInterface())
+ typeError(_function.location(), "Internal functions cannot be payable.");
+ }
for (ASTPointer<VariableDeclaration> const& var: _function.parameters() + _function.returnParameters())
{
if (!type(*var)->canLiveOutsideStorage())
@@ -1328,14 +1336,16 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess)
fatalTypeError(
_memberAccess.location(),
"Member \"" + memberName + "\" not found or not visible "
- "after argument-dependent lookup in " + exprType->toString()
+ "after argument-dependent lookup in " + exprType->toString() +
+ (memberName == "value" ? " - did you forget the \"payable\" modifier?" : "")
);
}
else if (possibleMembers.size() > 1)
fatalTypeError(
_memberAccess.location(),
"Member \"" + memberName + "\" not unique "
- "after argument-dependent lookup in " + exprType->toString()
+ "after argument-dependent lookup in " + exprType->toString() +
+ (memberName == "value" ? " - did you forget the \"payable\" modifier?" : "")
);
auto& annotation = _memberAccess.annotation();