diff options
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r-- | ExpressionCompiler.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp index 5e5442ba..4be461b2 100644 --- a/ExpressionCompiler.cpp +++ b/ExpressionCompiler.cpp @@ -822,11 +822,7 @@ bool ExpressionCompiler::visit(IndexAccess const& _indexAccess) void ExpressionCompiler::endVisit(Identifier const& _identifier) { Declaration const* declaration = _identifier.getReferencedDeclaration(); - if (declaration == nullptr) - { - // no-op - } - else if (MagicVariableDeclaration const* magicVar = dynamic_cast<MagicVariableDeclaration const*>(declaration)) + if (MagicVariableDeclaration const* magicVar = dynamic_cast<MagicVariableDeclaration const*>(declaration)) { if (magicVar->getType()->getCategory() == Type::Category::Contract) // "this" or "super" @@ -849,6 +845,13 @@ void ExpressionCompiler::endVisit(Identifier const& _identifier) { // no-op } + else if (declaration == nullptr && _identifier.getOverloadedDeclarations().size() > 1) + { + // var x = f; + declaration = *_identifier.getOverloadedDeclarations().begin(); + FunctionDefinition const* functionDef = dynamic_cast<FunctionDefinition const*>(declaration); + m_context << m_context.getVirtualFunctionEntryLabel(*functionDef).pushTag(); + } else { BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Identifier type not expected in expression context.")); |