aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorLu Guanqun <guanqun.lu@gmail.com>2015-03-06 13:02:35 +0800
committerLu Guanqun <guanqun.lu@gmail.com>2015-03-08 22:50:54 +0800
commit40336154641da903f5721c3f2a3d136971236ed3 (patch)
treec6ecb37a98c2ef8fcfe30c3dd01112b6262c5812 /ExpressionCompiler.cpp
parentddcfd441f304e02203f9fbed2477d69d3e48328f (diff)
downloaddexon-solidity-40336154641da903f5721c3f2a3d136971236ed3.tar.gz
dexon-solidity-40336154641da903f5721c3f2a3d136971236ed3.tar.zst
dexon-solidity-40336154641da903f5721c3f2a3d136971236ed3.zip
make it work for var x = f;
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp13
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."));