Skip to content

Commit 6a7b1d3

Browse files
committed
[NFC] Improve some lookup-related doc comments
1 parent f7aa3aa commit 6a7b1d3

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

include/swift/AST/ModuleNameLookup.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ enum class ResolutionKind {
4444

4545
void simple_display(llvm::raw_ostream &out, ResolutionKind kind);
4646

47-
/// Performs a lookup into the given module and it's imports.
47+
/// Performs a lookup into the given module and its imports.
4848
///
49-
/// If 'moduleOrFile' is a ModuleDecl, we search the module and it's
49+
/// If 'moduleOrFile' is a ModuleDecl, we search the module and its
5050
/// public imports. If 'moduleOrFile' is a SourceFile, we search the
5151
/// file's parent module, the module's public imports, and the source
5252
/// file's private imports.
5353
///
54-
/// \param moduleOrFile The module or file unit whose imports to search.
54+
/// \param moduleOrFile The module or file unit to search, including imports.
5555
/// \param name The name to look up.
5656
/// \param[out] decls Any found decls will be added to this vector.
5757
/// \param lookupKind Whether this lookup is qualified or unqualified.

include/swift/AST/NameLookupRequests.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,21 @@ class LookupInModuleRequest
490490
private:
491491
friend SimpleRequest;
492492

493-
// Evaluation.
493+
/// Performs a lookup into the given module and its imports.
494+
///
495+
/// If 'moduleOrFile' is a ModuleDecl, we search the module and its
496+
/// public imports. If 'moduleOrFile' is a SourceFile, we search the
497+
/// file's parent module, the module's public imports, and the source
498+
/// file's private imports.
499+
///
500+
/// \param evaluator The request evaluator.
501+
/// \param moduleOrFile The module or file unit to search, including imports.
502+
/// \param name The name to look up.
503+
/// \param lookupKind Whether this lookup is qualified or unqualified.
504+
/// \param resolutionKind What sort of decl is expected.
505+
/// \param moduleScopeContext The top-level context from which the lookup is
506+
/// being performed, for checking access. This must be either a
507+
/// FileUnit or a Module.
494508
QualifiedLookupResult
495509
evaluate(Evaluator &evaluator, const DeclContext *moduleOrFile, DeclName name,
496510
NLKind lookupKind, namelookup::ResolutionKind resolutionKind,

lib/AST/ModuleNameLookup.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,21 @@ class ModuleNameLookup {
4949
resolutionKind(resolutionKind),
5050
respectAccessControl(!ctx.isAccessControlDisabled()) {}
5151

52-
/// Performs a qualified lookup into the given module and, if necessary, its
53-
/// reexports.
52+
/// Performs the qualified lookup requested by \p LookupStrategy into the
53+
/// given module and, if necessary, its reexports.
5454
///
55-
/// The results are appended to \p decls.
55+
/// If 'moduleOrFile' is a ModuleDecl, we search the module and it's
56+
/// public imports. If 'moduleOrFile' is a SourceFile, we search the
57+
/// file's parent module, the module's public imports, and the source
58+
/// file's private imports.
59+
///
60+
/// \param[out] decls Results are appended to this vector.
61+
/// \param moduleOrFile The module or file unit to search, including imports.
62+
/// \param accessPath The access path that was imported; if not empty, only
63+
/// the named declaration will be imported.
64+
/// \param moduleScopeContext The top-level context from which the lookup is
65+
/// being performed, for checking access. This must be either a
66+
/// FileUnit or a Module.
5667
void lookupInModule(SmallVectorImpl<ValueDecl *> &decls,
5768
const DeclContext *moduleOrFile,
5869
ImportPath::Access accessPath,
@@ -75,6 +86,10 @@ class LookupByName : public ModuleNameLookup<LookupByName> {
7586
const NLKind lookupKind;
7687

7788
public:
89+
/// \param ctx The AST context that the lookup will be performed in.
90+
/// \param name The name that will be looked up.
91+
/// \param lookupKind Whether this lookup is qualified or unqualified.
92+
/// \param resolutionKind What sort of decl is expected.
7893
LookupByName(ASTContext &ctx, ResolutionKind resolutionKind,
7994
DeclName name, NLKind lookupKind)
8095
: Super(ctx, resolutionKind), name(name),
@@ -87,6 +102,10 @@ class LookupByName : public ModuleNameLookup<LookupByName> {
87102
return true;
88103
}
89104

105+
/// \param module The module to search for declarations in.
106+
/// \param path The access path that was imported; if not empty, only the
107+
/// named declaration will be imported.
108+
/// \param[out] localDecls Results are appended to this vector.
90109
void doLocalLookup(ModuleDecl *module, ImportPath::Access path,
91110
OptionSet<ModuleLookupFlags> flags,
92111
SmallVectorImpl<ValueDecl *> &localDecls) {

0 commit comments

Comments
 (0)