diff options
Provide access to scoped structs.
Diffstat (limited to 'libsolidity/NameAndTypeResolver.cpp')
-rw-r--r-- | libsolidity/NameAndTypeResolver.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libsolidity/NameAndTypeResolver.cpp b/libsolidity/NameAndTypeResolver.cpp index 6b9b9584..d9f74ae1 100644 --- a/libsolidity/NameAndTypeResolver.cpp +++ b/libsolidity/NameAndTypeResolver.cpp @@ -130,6 +130,22 @@ vector<Declaration const*> NameAndTypeResolver::nameFromCurrentScope(ASTString c return m_currentScope->resolveName(_name, _recursive); } +Declaration const* NameAndTypeResolver::pathFromCurrentScope(vector<ASTString> const& _path, bool _recursive) +{ + solAssert(!_path.empty(), ""); + vector<Declaration const*> candidates = m_currentScope->resolveName(_path.front(), _recursive); + for (size_t i = 1; i < _path.size() && candidates.size() == 1; i++) + { + if (!m_scopes.count(candidates.front())) + return nullptr; + candidates = m_scopes.at(candidates.front()).resolveName(_path[i], false); + } + if (candidates.size() == 1) + return candidates.front(); + else + return nullptr; +} + vector<Declaration const*> NameAndTypeResolver::cleanedDeclarations( Identifier const& _identifier, vector<Declaration const*> const& _declarations |