diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-12-02 23:06:01 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2017-01-12 01:28:11 +0800 |
commit | 42b672617392ecb294447f73fd011092cd58702b (patch) | |
tree | 3b179f26b63673593ae344d3c9c767dca7293134 /libsolidity/analysis | |
parent | bff76c1ca0433f88874fded8990f39292483d9f0 (diff) | |
download | dexon-solidity-42b672617392ecb294447f73fd011092cd58702b.tar.gz dexon-solidity-42b672617392ecb294447f73fd011092cd58702b.tar.zst dexon-solidity-42b672617392ecb294447f73fd011092cd58702b.zip |
analysis: allow some shadowings explicitly
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/NameAndTypeResolver.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index fc107ba0..002ff811 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -296,6 +296,14 @@ void NameAndTypeResolver::importInheritedScope(ContractDefinition const& _base) Declaration const* conflictingDeclaration = m_currentScope->conflictingDeclaration(*declaration); solAssert(conflictingDeclaration, ""); + // Usual shadowing is not an error + if (dynamic_cast<VariableDeclaration const*>(declaration) && dynamic_cast<VariableDeclaration const*>(conflictingDeclaration)) + continue; + + // Usual shadowing is not an error + if (dynamic_cast<ModifierDefinition const*>(declaration) && dynamic_cast<ModifierDefinition const*>(conflictingDeclaration)) + continue; + if (declaration->location().start < conflictingDeclaration->location().start) { firstDeclarationLocation = declaration->location(); |