diff options
author | chriseth <chris@ethereum.org> | 2018-02-16 18:03:56 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-02-20 20:06:28 +0800 |
commit | 4272d16f30e78d252e96b80f1202a61a06518a9f (patch) | |
tree | 16ffcc9e7c7ab3f37199e48a7de18edeb3c2978e | |
parent | decfa0eed0512ec20aa15c3b7656f8369e9fdcba (diff) | |
download | dexon-solidity-4272d16f30e78d252e96b80f1202a61a06518a9f.tar.gz dexon-solidity-4272d16f30e78d252e96b80f1202a61a06518a9f.tar.zst dexon-solidity-4272d16f30e78d252e96b80f1202a61a06518a9f.zip |
Fix shadowing for imports with aliases.
-rw-r--r-- | libsolidity/analysis/NameAndTypeResolver.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp index 5e4d414b..662792a3 100644 --- a/libsolidity/analysis/NameAndTypeResolver.cpp +++ b/libsolidity/analysis/NameAndTypeResolver.cpp @@ -457,9 +457,10 @@ bool DeclarationRegistrationHelper::registerDeclaration( if (!_errorLocation) _errorLocation = &_declaration.location(); + string name = _name ? *_name : _declaration.name(); Declaration const* shadowedDeclaration = nullptr; - if (_warnOnShadow && !_declaration.name().empty() && _container.enclosingContainer()) - for (auto const* decl: _container.enclosingContainer()->resolveName(_declaration.name(), true)) + if (_warnOnShadow && !name.empty() && _container.enclosingContainer()) + for (auto const* decl: _container.enclosingContainer()->resolveName(name, true)) shadowedDeclaration = decl; if (!_container.registerDeclaration(_declaration, _name, !_declaration.isVisibleInContract())) |