Merge pull request #5451 from ethereum/bound_function_tests

Add assert and tests for bound functions
This commit is contained in:
chriseth
2018-11-22 18:23:46 +01:00
committed by GitHub
5 changed files with 46 additions and 0 deletions
@@ -529,6 +529,8 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
{
bool shortcutTaken = false;
if (auto identifier = dynamic_cast<Identifier const*>(&_functionCall.expression()))
{
solAssert(!function.bound(), "");
if (auto functionDef = dynamic_cast<FunctionDefinition const*>(identifier->annotation().referencedDeclaration))
{
// Do not directly visit the identifier, because this way, we can avoid
@@ -537,6 +539,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
utils().pushCombinedFunctionEntryLabel(m_context.resolveVirtualFunction(*functionDef), false);
shortcutTaken = true;
}
}
if (!shortcutTaken)
_functionCall.expression().accept(*this);