diff options
author | chriseth <chris@ethereum.org> | 2017-08-04 20:27:53 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-08-05 01:06:24 +0800 |
commit | 060d229a22c14b7e597107c81283cde40f180f7f (patch) | |
tree | 4180047501014ffc7d8d193b8b8675b1bad05d79 /libsolidity/analysis/NameAndTypeResolver.cpp | |
parent | 32acadf43d655413e65428475a35e7ef3bf8fb78 (diff) | |
download | dexon-solidity-060d229a22c14b7e597107c81283cde40f180f7f.tar dexon-solidity-060d229a22c14b7e597107c81283cde40f180f7f.tar.gz dexon-solidity-060d229a22c14b7e597107c81283cde40f180f7f.tar.bz2 dexon-solidity-060d229a22c14b7e597107c81283cde40f180f7f.tar.lz dexon-solidity-060d229a22c14b7e597107c81283cde40f180f7f.tar.xz dexon-solidity-060d229a22c14b7e597107c81283cde40f180f7f.tar.zst dexon-solidity-060d229a22c14b7e597107c81283cde40f180f7f.zip |
Search for shadowee starting from parent scope.
Diffstat (limited to 'libsolidity/analysis/NameAndTypeResolver.cpp')
-rw-r--r-- | libsolidity/analysis/NameAndTypeResolver.cpp | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 83de2b3e..523e7176 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -439,23 +439,6 @@ DeclarationRegistrationHelper::DeclarationRegistrationHelper( solAssert(m_currentScope == _currentScope, "Scopes not correctly closed."); } -bool DeclarationRegistrationHelper::isOverloadedFunction( - Declaration const& _declaration1, - Declaration const& _declaration2 -) -{ - auto const* function1 = dynamic_cast<FunctionDefinition const*>(&_declaration1); - auto const* function2 = dynamic_cast<FunctionDefinition const*>(&_declaration2); - - if (!function1 || !function2) - return false; - - if (function1->parameters() != function2->parameters()) - return true; - - return false; -} - bool DeclarationRegistrationHelper::registerDeclaration( DeclarationContainer& _container, Declaration const& _declaration, @@ -469,13 +452,9 @@ bool DeclarationRegistrationHelper::registerDeclaration( _errorLocation = &_declaration.location(); Declaration const* shadowedDeclaration = nullptr; - if (_warnOnShadow && !_declaration.name().empty()) - for (auto const* decl: _container.resolveName(_declaration.name(), true)) - if (decl != &_declaration && !isOverloadedFunction(*decl, _declaration)) - { - shadowedDeclaration = decl; - break; - } + if (_warnOnShadow && !_declaration.name().empty() && _container.enclosingContainer()) + for (auto const* decl: _container.enclosingContainer()->resolveName(_declaration.name(), true)) + shadowedDeclaration = decl; if (!_container.registerDeclaration(_declaration, _name, !_declaration.isVisibleInContract())) { |