aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-02-09 22:09:22 +0800
committerchriseth <chris@ethereum.org>2018-02-27 19:17:25 +0800
commit53289e15a2e1ea540a0c3abe28219c326a614fe5 (patch)
tree594eeef1ab9c91640e355748495eb5ee4e2a5081 /libsolidity/analysis
parent9c31a0d8f584f245ce368dc57ee760fe752f3ca6 (diff)
downloaddexon-solidity-53289e15a2e1ea540a0c3abe28219c326a614fe5.tar.gz
dexon-solidity-53289e15a2e1ea540a0c3abe28219c326a614fe5.tar.zst
dexon-solidity-53289e15a2e1ea540a0c3abe28219c326a614fe5.zip
Make all lookups recursive by default.
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r--libsolidity/analysis/NameAndTypeResolver.cpp8
-rw-r--r--libsolidity/analysis/NameAndTypeResolver.h13
2 files changed, 11 insertions, 10 deletions
diff --git a/libsolidity/analysis/NameAndTypeResolver.cpp b/libsolidity/analysis/NameAndTypeResolver.cpp
index 662792a3..2693eb97 100644
--- a/libsolidity/analysis/NameAndTypeResolver.cpp
+++ b/libsolidity/analysis/NameAndTypeResolver.cpp
@@ -159,15 +159,15 @@ vector<Declaration const*> NameAndTypeResolver::resolveName(ASTString const& _na
return iterator->second->resolveName(_name, false);
}
-vector<Declaration const*> NameAndTypeResolver::nameFromCurrentScope(ASTString const& _name, bool _recursive) const
+vector<Declaration const*> NameAndTypeResolver::nameFromCurrentScope(ASTString const& _name) const
{
- return m_currentScope->resolveName(_name, _recursive);
+ return m_currentScope->resolveName(_name, true);
}
-Declaration const* NameAndTypeResolver::pathFromCurrentScope(vector<ASTString> const& _path, bool _recursive) const
+Declaration const* NameAndTypeResolver::pathFromCurrentScope(vector<ASTString> const& _path) const
{
solAssert(!_path.empty(), "");
- vector<Declaration const*> candidates = m_currentScope->resolveName(_path.front(), _recursive);
+ vector<Declaration const*> candidates = m_currentScope->resolveName(_path.front(), true);
for (size_t i = 1; i < _path.size() && candidates.size() == 1; i++)
{
if (!m_scopes.count(candidates.front()))
diff --git a/libsolidity/analysis/NameAndTypeResolver.h b/libsolidity/analysis/NameAndTypeResolver.h
index 9aea07ab..35f5d31e 100644
--- a/libsolidity/analysis/NameAndTypeResolver.h
+++ b/libsolidity/analysis/NameAndTypeResolver.h
@@ -73,16 +73,17 @@ public:
/// Resolves the given @a _name inside the scope @a _scope. If @a _scope is omitted,
/// the global scope is used (i.e. the one containing only the pre-defined global variables).
/// @returns a pointer to the declaration on success or nullptr on failure.
+ /// SHOULD only be used for testing.
std::vector<Declaration const*> resolveName(ASTString const& _name, ASTNode const* _scope = nullptr) const;
- /// Resolves a name in the "current" scope. Should only be called during the initial
- /// resolving phase.
- std::vector<Declaration const*> nameFromCurrentScope(ASTString const& _name, bool _recursive = true) const;
+ /// Resolves a name in the "current" scope, but also searches parent scopes.
+ /// Should only be called during the initial resolving phase.
+ std::vector<Declaration const*> nameFromCurrentScope(ASTString const& _name) const;
- /// Resolves a path starting from the "current" scope. Should only be called during the initial
- /// resolving phase.
+ /// Resolves a path starting from the "current" scope, but also searches parent scopes.
+ /// Should only be called during the initial resolving phase.
/// @note Returns a null pointer if any component in the path was not unique or not found.
- Declaration const* pathFromCurrentScope(std::vector<ASTString> const& _path, bool _recursive = true) const;
+ Declaration const* pathFromCurrentScope(std::vector<ASTString> const& _path) const;
/// returns the vector of declarations without repetitions
std::vector<Declaration const*> cleanedDeclarations(