Skip to content

Commit cc75d6d

Browse files
committed
[NFC] Improve some lookup-related doc comments
1 parent b5d9339 commit cc75d6d

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
@@ -51,10 +51,21 @@ class ModuleNameLookup {
5151
resolutionKind(resolutionKind),
5252
respectAccessControl(!ctx.isAccessControlDisabled()) {}
5353

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

7990
public:
91+
/// \param ctx The AST context that the lookup will be performed in.
92+
/// \param name The name that will be looked up.
93+
/// \param lookupKind Whether this lookup is qualified or unqualified.
94+
/// \param resolutionKind What sort of decl is expected.
8095
LookupByName(ASTContext &ctx, ResolutionKind resolutionKind,
8196
DeclName name, NLKind lookupKind)
8297
: Super(ctx, resolutionKind), name(name),
@@ -89,6 +104,10 @@ class LookupByName : public ModuleNameLookup<LookupByName> {
89104
return true;
90105
}
91106

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

0 commit comments

Comments
 (0)