@@ -39,11 +39,10 @@ class DeclarationContainer
3939public:
4040 using Homonyms = std::vector<std::pair<langutil::SourceLocation const *, std::vector<Declaration const *>>>;
4141
42- explicit DeclarationContainer (
43- ASTNode const * _enclosingNode = nullptr ,
44- DeclarationContainer* _enclosingContainer = nullptr
45- ):
46- m_enclosingNode(_enclosingNode), m_enclosingContainer(_enclosingContainer)
42+ DeclarationContainer () = default ;
43+ explicit DeclarationContainer (ASTNode const * _enclosingNode, DeclarationContainer* _enclosingContainer):
44+ m_enclosingNode(_enclosingNode),
45+ m_enclosingContainer(_enclosingContainer)
4746 {
4847 if (_enclosingContainer)
4948 _enclosingContainer->m_innerContainers .emplace_back (this );
@@ -57,7 +56,20 @@ class DeclarationContainer
5756 bool registerDeclaration (Declaration const & _declaration, ASTString const * _name, langutil::SourceLocation const * _location, bool _invisible, bool _update);
5857 bool registerDeclaration (Declaration const & _declaration, bool _invisible, bool _update);
5958
60- std::vector<Declaration const *> resolveName (ASTString const & _name, bool _recursive = false , bool _alsoInvisible = false ) const ;
59+ // / Finds all declarations that in the current scope can be referred to using specified name.
60+ // / @param _name the name to look for.
61+ // / @param _recursive if true and there are no matching declarations in the current container,
62+ // / recursively searches the enclosing containers as well.
63+ // / @param _alsoInvisible if true, include invisible declaration in the results.
64+ // / @param _onlyVisibleAsUnqualifiedNames if true, do not include declarations which can never
65+ // / actually be referenced using their name alone (without being qualified with the name
66+ // / of scope in which they are declared).
67+ std::vector<Declaration const *> resolveName (
68+ ASTString const & _name,
69+ bool _recursive = false ,
70+ bool _alsoInvisible = false ,
71+ bool _onlyVisibleAsUnqualifiedNames = false
72+ ) const ;
6173 ASTNode const * enclosingNode () const { return m_enclosingNode; }
6274 DeclarationContainer const * enclosingContainer () const { return m_enclosingContainer; }
6375 std::map<ASTString, std::vector<Declaration const *>> const & declarations () const { return m_declarations; }
@@ -80,8 +92,8 @@ class DeclarationContainer
8092 void populateHomonyms (std::back_insert_iterator<Homonyms> _it) const ;
8193
8294private:
83- ASTNode const * m_enclosingNode;
84- DeclarationContainer const * m_enclosingContainer;
95+ ASTNode const * m_enclosingNode = nullptr ;
96+ DeclarationContainer const * m_enclosingContainer = nullptr ;
8597 std::vector<DeclarationContainer const *> m_innerContainers;
8698 std::map<ASTString, std::vector<Declaration const *>> m_declarations;
8799 std::map<ASTString, std::vector<Declaration const *>> m_invisibleDeclarations;
0 commit comments