aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-27 21:32:59 +0800
committerChristian <c@ethdev.com>2015-01-29 07:29:43 +0800
commitae5a6a235c9d0996a712903e0cfd0560b326bbad (patch)
tree51e9e64e0a4f59172d4de9345e15100d3fd96268 /ExpressionCompiler.cpp
parentb5a786dda19e54fa587b1b693e7a139818d65b9e (diff)
downloaddexon-solidity-ae5a6a235c9d0996a712903e0cfd0560b326bbad.tar.gz
dexon-solidity-ae5a6a235c9d0996a712903e0cfd0560b326bbad.tar.zst
dexon-solidity-ae5a6a235c9d0996a712903e0cfd0560b326bbad.zip
Super keyword.
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();