Skip to content

Commit 2905ea5

Browse files
committed
Rename isSelfSufficient to isVisibleAsUnqualifiedName
1 parent 31cc995 commit 2905ea5

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

libsolidity/analysis/DeclarationContainer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ bool DeclarationContainer::registerDeclaration(
121121
if (conflictingDeclaration(_declaration, _name))
122122
return false;
123123

124-
if (m_enclosingContainer && _declaration.isNameSelfSufficient())
124+
if (m_enclosingContainer && _declaration.isVisibleAsUnqualifiedName())
125125
m_homonymCandidates.emplace_back(*_name, _location ? _location : &_declaration.location());
126126
}
127127

@@ -144,16 +144,16 @@ vector<Declaration const*> DeclarationContainer::resolveName(
144144
ASTString const& _name,
145145
bool _recursive,
146146
bool _alsoInvisible,
147-
bool _onlySelfSufficientNames
147+
bool _onlyVisibleAsUnqualifiedNames
148148
) const
149149
{
150150
solAssert(!_name.empty(), "Attempt to resolve empty name.");
151151
vector<Declaration const*> result;
152152

153-
auto filter = [&result, &_onlySelfSufficientNames](vector<Declaration const*> _declarations) {
154-
_onlySelfSufficientNames ?
153+
auto filter = [&result, &_onlyVisibleAsUnqualifiedNames](vector<Declaration const*> _declarations) {
154+
_onlyVisibleAsUnqualifiedNames ?
155155
copy_if(_declarations.cbegin(), _declarations.cend(), back_inserter(result), [](auto& _declaration) {
156-
return _declaration->isNameSelfSufficient();
156+
return _declaration->isVisibleAsUnqualifiedName();
157157
}) :
158158
copy(_declarations.cbegin(), _declarations.cend(), back_inserter(result));
159159
};

libsolidity/analysis/DeclarationContainer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class DeclarationContainer
6060
ASTString const& _name,
6161
bool _recursive = false,
6262
bool _alsoInvisible = false,
63-
bool _onlySelfSufficientNames = false
63+
bool _onlyVisibleAsUnqualifiedNames = false
6464
) const;
6565
ASTNode const* enclosingNode() const { return m_enclosingNode; }
6666
DeclarationContainer const* enclosingContainer() const { return m_enclosingContainer; }

libsolidity/ast/AST.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,14 @@ bool Declaration::isEventParameter() const
498498
return dynamic_cast<EventDefinition const*>(scope());
499499
}
500500

501-
bool Declaration::isNameSelfSufficient() const
501+
bool Declaration::isVisibleAsUnqualifiedName() const
502502
{
503503
if (!scope())
504504
return true;
505505
if (isStructMember() || isEnumValue() || isEventParameter())
506506
return false;
507507
if (auto functionDefinition = dynamic_cast<FunctionDefinition const*>(scope()))
508-
if (!functionDefinition->hasBody())
508+
if (!functionDefinition->isImplemented())
509509
return false; // parameter of a function without body
510510
return true;
511511
}

libsolidity/ast/AST.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class Declaration: public ASTNode, public Scopable
272272
/// Usually the name alone can be used to refer to the corresponding entity.
273273
/// But, for example, struct member names or enum member names require a prefix.
274274
/// Another example is event parameter names, which do not participate in any proper scope.
275-
bool isNameSelfSufficient() const;
275+
bool isVisibleAsUnqualifiedName() const;
276276

277277
/// @returns the type of expressions referencing this declaration.
278278
/// This can only be called once types of variable declarations have already been resolved.

0 commit comments

Comments
 (0)