@@ -118,20 +118,25 @@ class UnqualifiedLookup {
118118 // / That is, \c makeArrayRef(Results).take_front(IndexOfFirstOuterResults)
119119 // / will be Results from the innermost scope that had results, and the
120120 // / 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`.
121125 size_t IndexOfFirstOuterResult;
122126
123127 // / Return true if anything was found by the name lookup.
124128 bool isSuccess () const { return !Results.empty (); }
125129
126130 // / Get the result as a single type, or a null type if that fails.
127- TypeDecl *getSingleTypeResult ();
131+ TypeDecl *getSingleTypeResult () const ;
128132};
129133
130134inline UnqualifiedLookup::Options operator |(UnqualifiedLookup::Flags flag1,
131135 UnqualifiedLookup::Flags flag2) {
132136 return UnqualifiedLookup::Options (flag1) | flag2;
133137}
134138
139+
135140// / Describes the reason why a certain declaration is visible.
136141enum class DeclVisibilityKind {
137142 // / Declaration is a local variable or type.
@@ -352,6 +357,29 @@ void lookupInModule(ModuleDecl *module, ModuleDecl::AccessPathTy accessPath,
352357 const DeclContext *moduleScopeContext,
353358 ArrayRef<ModuleDecl::ImportedModule> extraImports = {});
354359
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+
355383} // end namespace namelookup
356384
357385// / Retrieve the set of nominal type declarations that are directly
0 commit comments