aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-20 02:18:34 +0800
committerChristian <c@ethdev.com>2015-01-20 06:35:04 +0800
commit6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9 (patch)
tree0cedcacb974cd0d7f15734bccde634e76c47a565 /ExpressionCompiler.cpp
parent4d833bc86bf10a685a8b5d72e90c49a24a33f8b3 (diff)
downloaddexon-solidity-6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9.tar.gz
dexon-solidity-6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9.tar.zst
dexon-solidity-6e111d5d1da2a0ae397fa2bd846d13132cdd6dd9.zip
Explicit calls to base class function.
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp34
1 files changed, 26 insertions, 8 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 5a45bfd6..60c5c4de 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -419,6 +419,22 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
m_currentLValue.retrieveValueIfLValueNotRequested(_memberAccess);
break;
}
+ case Type::Category::TYPE:
+ {
+ TypeType const& type = dynamic_cast<TypeType const&>(*_memberAccess.getExpression().getType());
+ if (type.getMembers().getMemberType(member))
+ {
+ ContractDefinition const& contract = dynamic_cast<ContractType const&>(*type.getActualType())
+ .getContractDefinition();
+ for (ASTPointer<FunctionDefinition> const& function: contract.getDefinedFunctions())
+ if (function->getName() == member)
+ {
+ m_context << m_context.getFunctionEntryLabel(*function).pushTag();
+ return;
+ }
+ }
+ BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid member access to " + type.toString()));
+ }
default:
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Member access to unknown type."));
}
@@ -449,20 +465,22 @@ void ExpressionCompiler::endVisit(Identifier const& _identifier)
{
if (magicVar->getType()->getCategory() == Type::Category::CONTRACT) // must be "this"
m_context << eth::Instruction::ADDRESS;
- return;
}
- if (FunctionDefinition const* functionDef = dynamic_cast<FunctionDefinition const*>(declaration))
- {
+ else if (FunctionDefinition const* functionDef = dynamic_cast<FunctionDefinition const*>(declaration))
m_context << m_context.getVirtualFunctionEntryLabel(*functionDef).pushTag();
- return;
- }
- if (dynamic_cast<VariableDeclaration const*>(declaration))
+ else if (dynamic_cast<VariableDeclaration const*>(declaration))
{
m_currentLValue.fromIdentifier(_identifier, *declaration);
m_currentLValue.retrieveValueIfLValueNotRequested(_identifier);
- return;
}
- BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Identifier type not expected in expression context."));
+ else if (dynamic_cast<ContractDefinition const*>(declaration))
+ {
+ // no-op
+ }
+ else
+ {
+ BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Identifier type not expected in expression context."));
+ }
}
void ExpressionCompiler::endVisit(Literal const& _literal)