aboutsummaryrefslogtreecommitdiffstats
path: root/NameAndTypeResolver.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-02-14 07:43:02 +0800
committerChristian <c@ethdev.com>2015-02-17 02:24:07 +0800
commit3e29ec2cb2075fc6734a0f350503c393fbeeb3d6 (patch)
tree21012d2ea633c1473d057daea4f3b4ff7e60a574 /NameAndTypeResolver.cpp
parent500cb69f12a1e048258b1ebb9fa5ea858433ffff (diff)
downloaddexon-solidity-3e29ec2cb2075fc6734a0f350503c393fbeeb3d6.tar.gz
dexon-solidity-3e29ec2cb2075fc6734a0f350503c393fbeeb3d6.tar.zst
dexon-solidity-3e29ec2cb2075fc6734a0f350503c393fbeeb3d6.zip
"external" visibility specifier.
Diffstat (limited to 'NameAndTypeResolver.cpp')
-rw-r--r--NameAndTypeResolver.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/NameAndTypeResolver.cpp b/NameAndTypeResolver.cpp
index dbe5693a..ea70b65b 100644
--- a/NameAndTypeResolver.cpp
+++ b/NameAndTypeResolver.cpp
@@ -86,7 +86,7 @@ void NameAndTypeResolver::checkTypeRequirements(ContractDefinition& _contract)
void NameAndTypeResolver::updateDeclaration(Declaration const& _declaration)
{
- m_scopes[nullptr].registerDeclaration(_declaration, true);
+ m_scopes[nullptr].registerDeclaration(_declaration, false, true);
solAssert(_declaration.getScope() == nullptr, "Updated declaration outside global scope.");
}
@@ -110,8 +110,9 @@ void NameAndTypeResolver::importInheritedScope(ContractDefinition const& _base)
for (auto const& nameAndDeclaration: iterator->second.getDeclarations())
{
Declaration const* declaration = nameAndDeclaration.second;
- // Import if it was declared in the base and is not the constructor
- if (declaration->getScope() == &_base && declaration->getName() != _base.getName())
+ // Import if it was declared in the base, is not the constructor and is visible in derived classes
+ if (declaration->getScope() == &_base && declaration->getName() != _base.getName() &&
+ declaration->isVisibleInDerivedContracts())
m_currentScope->registerDeclaration(*declaration);
}
}
@@ -308,7 +309,7 @@ void DeclarationRegistrationHelper::closeCurrentScope()
void DeclarationRegistrationHelper::registerDeclaration(Declaration& _declaration, bool _opensScope)
{
- if (!m_scopes[m_currentScope].registerDeclaration(_declaration))
+ if (!m_scopes[m_currentScope].registerDeclaration(_declaration, !_declaration.isVisibleInContract()))
BOOST_THROW_EXCEPTION(DeclarationError() << errinfo_sourceLocation(_declaration.getLocation())
<< errinfo_comment("Identifier already declared."));
//@todo the exception should also contain the location of the first declaration