aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 15ee17fd..d2f709be 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -366,14 +366,22 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
case Type::Category::CONTRACT:
{
ContractType const& type = dynamic_cast<ContractType const&>(*_memberAccess.getExpression().getType());
- u256 identifier = type.getFunctionIdentifier(member);
- if (identifier != Invalid256)
+ if (type.isSuper())
{
- appendTypeConversion(type, IntegerType(0, IntegerType::Modifier::ADDRESS), true);
- m_context << identifier;
+ m_context << m_context.getSuperFunctionEntryLabel(member, type.getContractDefinition()).pushTag();
break;
}
- // fall-through to "integer" otherwise (address)
+ else
+ {
+ u256 identifier = type.getFunctionIdentifier(member);
+ if (identifier != Invalid256)
+ {
+ appendTypeConversion(type, IntegerType(0, IntegerType::Modifier::ADDRESS), true);
+ m_context << identifier;
+ break;
+ }
+ // fall-through to "integer" otherwise (address)
+ }
}
case Type::Category::INTEGER:
if (member == "balance")
@@ -469,8 +477,10 @@ void ExpressionCompiler::endVisit(Identifier const& _identifier)
Declaration const* declaration = _identifier.getReferencedDeclaration();
if (MagicVariableDeclaration const* magicVar = dynamic_cast<MagicVariableDeclaration const*>(declaration))
{
- if (magicVar->getType()->getCategory() == Type::Category::CONTRACT) // must be "this"
- m_context << eth::Instruction::ADDRESS;
+ if (magicVar->getType()->getCategory() == Type::Category::CONTRACT)
+ // "this" or "super"
+ if (!dynamic_cast<ContractType const&>(*magicVar->getType()).isSuper())
+ m_context << eth::Instruction::ADDRESS;
}
else if (FunctionDefinition const* functionDef = dynamic_cast<FunctionDefinition const*>(declaration))
m_context << m_context.getVirtualFunctionEntryLabel(*functionDef).pushTag();