@@ -118,20 +118,25 @@ class UnqualifiedLookup {
118
118
// / That is, \c makeArrayRef(Results).take_front(IndexOfFirstOuterResults)
119
119
// / will be Results from the innermost scope that had results, and the
120
120
// / remaining elements of Results will be from parent scopes of this one.
121
+ // /
122
+ // / Allows unqualified name lookup to return results from outer scopes.
123
+ // / This is necessary for disambiguating calls to functions like `min` and
124
+ // / `max`.
121
125
size_t IndexOfFirstOuterResult;
122
126
123
127
// / Return true if anything was found by the name lookup.
124
128
bool isSuccess () const { return !Results.empty (); }
125
129
126
130
// / Get the result as a single type, or a null type if that fails.
127
- TypeDecl *getSingleTypeResult ();
131
+ TypeDecl *getSingleTypeResult () const ;
128
132
};
129
133
130
134
inline UnqualifiedLookup::Options operator |(UnqualifiedLookup::Flags flag1,
131
135
UnqualifiedLookup::Flags flag2) {
132
136
return UnqualifiedLookup::Options (flag1) | flag2;
133
137
}
134
138
139
+
135
140
// / Describes the reason why a certain declaration is visible.
136
141
enum class DeclVisibilityKind {
137
142
// / Declaration is a local variable or type.
@@ -352,6 +357,29 @@ void lookupInModule(ModuleDecl *module, ModuleDecl::AccessPathTy accessPath,
352
357
const DeclContext *moduleScopeContext,
353
358
ArrayRef<ModuleDecl::ImportedModule> extraImports = {});
354
359
360
+ template <typename Fn>
361
+ void forAllVisibleModules (const DeclContext *DC, const Fn &fn) {
362
+ DeclContext *moduleScope = DC->getModuleScopeContext ();
363
+ if (auto file = dyn_cast<FileUnit>(moduleScope))
364
+ file->forAllVisibleModules (fn);
365
+ else
366
+ cast<ModuleDecl>(moduleScope)
367
+ ->forAllVisibleModules (ModuleDecl::AccessPathTy (), fn);
368
+ }
369
+
370
+ // / Only name lookup has gathered a set of results, perform any necessary
371
+ // / steps to prune the result set before returning it to the caller.
372
+ bool finishLookup (const DeclContext *dc, NLOptions options,
373
+ SmallVectorImpl<ValueDecl *> &decls);
374
+
375
+ // / Do nothing if debugClient is null.
376
+ template <typename Result>
377
+ void filterForDiscriminator (SmallVectorImpl<Result> &results,
378
+ DebuggerClient *debugClient);
379
+
380
+ void recordLookupOfTopLevelName (DeclContext *topLevelContext, DeclName name,
381
+ bool isCascading);
382
+
355
383
} // end namespace namelookup
356
384
357
385
// / Retrieve the set of nominal type declarations that are directly
0 commit comments