Skip to content

[Gardening] Change calls of getName().isOperator() to isOperator() #8015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ static bool isInPrivateOrLocalContext(const ValueDecl *D) {
}

void ASTMangler::appendDeclName(const ValueDecl *decl) {
if (decl->getName().isOperator()) {
if (decl->isOperator()) {
appendIdentifier(translateOperator(decl->getName().str()));
switch (decl->getAttrs().getUnaryOperatorKind()) {
case UnaryOperatorKind::Prefix:
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ DescriptiveDeclKind Decl::getDescriptiveKind() const {
return DescriptiveDeclKind::MaterializeForSet;
}

if (!func->getName().empty() && func->getName().isOperator())
if (func->isOperator())
return DescriptiveDeclKind::OperatorFunction;

if (func->getDeclContext()->isLocalContext())
Expand Down
4 changes: 2 additions & 2 deletions lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ bool Expr::canAppendCallParentheses() const {
return true;

case ExprKind::DeclRef:
return !cast<DeclRefExpr>(this)->getDecl()->getName().isOperator();
return !cast<DeclRefExpr>(this)->getDecl()->isOperator();

case ExprKind::SuperRef:
case ExprKind::OtherConstructorDeclRef:
Expand All @@ -676,7 +676,7 @@ bool Expr::canAppendCallParentheses() const {
auto *overloadedExpr = cast<OverloadedDeclRefExpr>(this);
if (overloadedExpr->getDecls().empty())
return false;
return !overloadedExpr->getDecls().front()->getName().isOperator();
return !overloadedExpr->getDecls().front()->isOperator();
}

case ExprKind::UnresolvedDeclRef:
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Mangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ void Mangler::bindGenericParameters(const DeclContext *DC) {
}

static OperatorFixity getDeclFixity(const ValueDecl *decl) {
if (!decl->getName().isOperator())
if (!decl->isOperator())
return OperatorFixity::NotOperator;

switch (decl->getAttrs().getUnaryOperatorKind()) {
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void SourceLookupCache::doPopulateCache(Range decls,
bool onlyOperators) {
for (Decl *D : decls) {
if (ValueDecl *VD = dyn_cast<ValueDecl>(D))
if (onlyOperators ? VD->getName().isOperator() : VD->hasName()) {
if (onlyOperators ? VD->isOperator() : VD->hasName()) {
// Cache the value under both its compound name and its full name.
TopLevelValues.add(VD);
}
Expand Down
5 changes: 2 additions & 3 deletions lib/Sema/CSSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2317,12 +2317,11 @@ static bool shortCircuitDisjunctionAt(Constraint *constraint,
// overloaded operators.
if (constraint->getKind() == ConstraintKind::BindOverload &&
constraint->getOverloadChoice().getKind() == OverloadChoiceKind::Decl &&
constraint->getOverloadChoice().getDecl()->getName().isOperator() &&
constraint->getOverloadChoice().getDecl()->isOperator() &&
successfulConstraint->getKind() == ConstraintKind::BindOverload &&
successfulConstraint->getOverloadChoice().getKind()
== OverloadChoiceKind::Decl &&
successfulConstraint->getOverloadChoice().getDecl()->getName()
.isOperator() &&
successfulConstraint->getOverloadChoice().getDecl()->isOperator() &&
constraint->getOverloadChoice().getDecl()->getInterfaceType()
->is<GenericFunctionType>() &&
!successfulConstraint->getOverloadChoice().getDecl()->getInterfaceType()
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ void AttributeChecker::checkOperatorAttribute(DeclAttribute *attr) {

// Only functions with an operator identifier can be declared with as an
// operator.
if (!FD->getName().isOperator()) {
if (!FD->isOperator()) {
TC.diagnose(D->getStartLoc(), diag::attribute_requires_operator_identifier,
attr->getAttrName());
attr->setInvalid();
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ WitnessChecker::lookupValueWitnesses(ValueDecl *req, bool *ignoringNames) {
assert(!isa<AssociatedTypeDecl>(req) && "Not for lookup for type witnesses*");

SmallVector<ValueDecl *, 4> witnesses;
if (req->getName().isOperator()) {
if (req->isOperator()) {
// Operator lookup is always global.
auto lookupOptions = defaultUnqualifiedLookupOptions;
if (!DC->isCascadingContextForLookup(false))
Expand Down
2 changes: 1 addition & 1 deletion tools/SourceKit/lib/SwiftLang/SwiftSourceDocInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ void SwiftLangSupport::findRelatedIdentifiersInFile(
isa<DestructorDecl>(VD) ||
isa<SubscriptDecl>(VD)))
return;
if (VD->getName().isOperator())
if (VD->isOperator())
return;

RelatedIdScanner Scanner(SrcFile, BufferID, VD, Ranges);
Expand Down