Skip to content

Commit 306cfd8

Browse files
committed
Constification
1 parent fdf8326 commit 306cfd8

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

include/swift/AST/NameLookup.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class UnqualifiedLookup {
130130
bool isSuccess() const { return !Results.empty(); }
131131

132132
/// Get the result as a single type, or a null type if that fails.
133-
TypeDecl *getSingleTypeResult();
133+
TypeDecl *getSingleTypeResult() const;
134134

135135
bool verifyEqual(const LegacyUnqualifiedLookup &&) const;
136136

@@ -218,7 +218,7 @@ class LegacyUnqualifiedLookup {
218218
bool isSuccess() const { return !Results.empty(); }
219219

220220
/// Get the result as a single type, or a null type if that fails.
221-
TypeDecl *getSingleTypeResult();
221+
TypeDecl *getSingleTypeResult() const;
222222

223223
public: // for exp debugging
224224
SourceFile const *recordedSF = nullptr;

lib/AST/UnqualifiedLookup.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -270,16 +270,16 @@ class UnqualifiedLookupFactory {
270270
template <typename NominalTypeDeclOrExtensionDecl>
271271
Optional<PerScopeLookupState>
272272
lookupInNominalTypeOrExtension(NominalTypeDeclOrExtensionDecl *D,
273-
Optional<bool> isCascadingUse);
273+
Optional<bool> isCascadingUse) const;
274274

275275
Optional<PerScopeLookupState>
276276
lookupInDefaultArgumentInitializer(DefaultArgumentInitializer *I,
277-
Optional<bool> isCascadingUse);
277+
Optional<bool> isCascadingUse) const;
278278

279279
bool isOutsideBodyOfFunction(const AbstractFunctionDecl *const AFD) const;
280280

281281
Optional<PerScopeLookupState>
282-
lookupInMiscContext(DeclContext *dc, Optional<bool> isCascadingUse);
282+
lookupInMiscContext(DeclContext *dc, Optional<bool> isCascadingUse) const;
283283

284284
/// Check the generic parameters of our context.
285285
/// Return true if done with lookup
@@ -844,7 +844,7 @@ UnqualifiedLookupFactory::lookupInClosure(AbstractClosureExpr *ACE,
844844
template <typename NominalTypeDeclOrExtensionDecl>
845845
Optional<UnqualifiedLookupFactory::PerScopeLookupState>
846846
UnqualifiedLookupFactory::lookupInNominalTypeOrExtension(
847-
NominalTypeDeclOrExtensionDecl *D, Optional<bool> isCascadingUse) {
847+
NominalTypeDeclOrExtensionDecl *D, Optional<bool> isCascadingUse) const {
848848
// clang-format off
849849
return PerScopeLookupState{
850850
false,
@@ -860,7 +860,7 @@ UnqualifiedLookupFactory::lookupInNominalTypeOrExtension(
860860

861861
Optional<UnqualifiedLookupFactory::PerScopeLookupState>
862862
UnqualifiedLookupFactory::lookupInDefaultArgumentInitializer(
863-
DefaultArgumentInitializer *I, Optional<bool> isCascadingUse) {
863+
DefaultArgumentInitializer *I, Optional<bool> isCascadingUse) const {
864864
// In a default argument, skip immediately out of both the
865865
// initializer and the function.
866866
// clang-format off
@@ -879,8 +879,8 @@ bool UnqualifiedLookupFactory::isOutsideBodyOfFunction(
879879
}
880880

881881
Optional<UnqualifiedLookupFactory::PerScopeLookupState>
882-
UnqualifiedLookupFactory::lookupInMiscContext(DeclContext *dc,
883-
Optional<bool> isCascadingUse) {
882+
UnqualifiedLookupFactory::lookupInMiscContext(
883+
DeclContext *dc, Optional<bool> isCascadingUse) const {
884884
// clang-format off
885885
assert(isa<TopLevelCodeDecl>(dc) ||
886886
isa<Initializer>(dc) ||
@@ -1618,7 +1618,7 @@ LegacyUnqualifiedLookup::LegacyUnqualifiedLookup(DeclName Name, DeclContext *DC,
16181618
(void)shouldReturnBasedOnResults(/*noMoreOuterResults=*/true);
16191619
}
16201620

1621-
TypeDecl *LegacyUnqualifiedLookup::getSingleTypeResult() {
1621+
TypeDecl *LegacyUnqualifiedLookup::getSingleTypeResult() const {
16221622
if (Results.size() != 1)
16231623
return nullptr;
16241624
return dyn_cast<TypeDecl>(Results.back().getValueDecl());
@@ -1662,7 +1662,7 @@ UnqualifiedLookup::UnqualifiedLookup(DeclName Name,
16621662
"bad refactoring");
16631663
}
16641664

1665-
TypeDecl *UnqualifiedLookup::getSingleTypeResult() {
1665+
TypeDecl *UnqualifiedLookup::getSingleTypeResult() const {
16661666
if (Results.size() != 1)
16671667
return nullptr;
16681668
return dyn_cast<TypeDecl>(Results.back().getValueDecl());

0 commit comments

Comments
 (0)