aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-02-09 09:06:30 +0800
committerLiana Husikyan <liana@ethdev.com>2015-02-09 09:06:30 +0800
commit2a5c2578bd7e07326412ac0345ed5f5283908ccb (patch)
tree863e089d25f486125099417bcc8f963a034bf41f /AST.cpp
parenta66db516fb1025b406c8fcdb694b7fb760f84695 (diff)
downloaddexon-solidity-2a5c2578bd7e07326412ac0345ed5f5283908ccb.tar.gz
dexon-solidity-2a5c2578bd7e07326412ac0345ed5f5283908ccb.tar.zst
dexon-solidity-2a5c2578bd7e07326412ac0345ed5f5283908ccb.zip
- implemented Empty parameter name story. Now the name of input/return parameters of function can be not specified.
- added appropriate tests Conflicts: test/SolidityEndToEndTest.cpp test/SolidityNameAndTypeResolution.cpp
Diffstat (limited to 'AST.cpp')
-rw-r--r--AST.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/AST.cpp b/AST.cpp
index 6f5b1f38..dbc32664 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -58,10 +58,21 @@ void ContractDefinition::checkTypeRequirements()
BOOST_THROW_EXCEPTION(constructor->getReturnParameterList()->createTypeError(
"Non-empty \"returns\" directive for constructor."));
- FunctionDefinition const* fallbackFunction = getFallbackFunction();
- if (fallbackFunction && fallbackFunction->getScope() == this && !fallbackFunction->getParameters().empty())
- BOOST_THROW_EXCEPTION(fallbackFunction->getParameterList().createTypeError(
- "Fallback function cannot take parameters."));
+ FunctionDefinition const* fallbackFunction = nullptr;
+ for (ASTPointer<FunctionDefinition> const& function: getDefinedFunctions())
+ {
+ if (function->getName().empty())
+ {
+ if (fallbackFunction)
+ BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_comment("Only one fallback function is allowed."));
+ else
+ {
+ fallbackFunction = function.get();
+ if (!fallbackFunction->getParameters().empty())
+ BOOST_THROW_EXCEPTION(fallbackFunction->getParameterList().createTypeError("Fallback function cannot take parameters."));
+ }
+ }
+ }
for (ASTPointer<ModifierDefinition> const& modifier: getFunctionModifiers())
modifier->checkTypeRequirements();