Skip to content

Commit 52d1805

Browse files
committed
[NFC] Improve some lookup-related doc comments
# Conflicts: # include/swift/AST/NameLookupRequests.h # lib/AST/ModuleNameLookup.cpp
1 parent fc870d0 commit 52d1805

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
@@ -41,14 +41,14 @@ enum class ResolutionKind {
4141

4242
void simple_display(llvm::raw_ostream &out, ResolutionKind kind);
4343

44-
/// Performs a lookup into the given module and it's imports.
44+
/// Performs a lookup into the given module and its imports.
4545
///
46-
/// If 'moduleOrFile' is a ModuleDecl, we search the module and it's
46+
/// If 'moduleOrFile' is a ModuleDecl, we search the module and its
4747
/// public imports. If 'moduleOrFile' is a SourceFile, we search the
4848
/// file's parent module, the module's public imports, and the source
4949
/// file's private imports.
5050
///
51-
/// \param moduleOrFile The module or file unit whose imports to search.
51+
/// \param moduleOrFile The module or file unit to search, including imports.
5252
/// \param name The name to look up.
5353
/// \param[out] decls Any found decls will be added to this vector.
5454
/// \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
@@ -425,7 +425,21 @@ class LookupInModuleRequest
425425
private:
426426
friend SimpleRequest;
427427

428-
// Evaluation.
428+
/// Performs a lookup into the given module and its imports.
429+
///
430+
/// If 'moduleOrFile' is a ModuleDecl, we search the module and its
431+
/// public imports. If 'moduleOrFile' is a SourceFile, we search the
432+
/// file's parent module, the module's public imports, and the source
433+
/// file's private imports.
434+
///
435+
/// \param evaluator The request evaluator.
436+
/// \param moduleOrFile The module or file unit to search, including imports.
437+
/// \param name The name to look up.
438+
/// \param lookupKind Whether this lookup is qualified or unqualified.
439+
/// \param resolutionKind What sort of decl is expected.
440+
/// \param moduleScopeContext The top-level context from which the lookup is
441+
/// being performed, for checking access. This must be either a
442+
/// FileUnit or a Module.
429443
QualifiedLookupResult
430444
evaluate(Evaluator &evaluator, const DeclContext *moduleOrFile, DeclName name,
431445
NLKind lookupKind, namelookup::ResolutionKind resolutionKind,

lib/AST/ModuleNameLookup.cpp

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,21 @@ class ModuleNameLookup {
4646
resolutionKind(resolutionKind),
4747
respectAccessControl(!ctx.isAccessControlDisabled()) {}
4848

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

7081
public:
82+
/// \param ctx The AST context that the lookup will be performed in.
83+
/// \param name The name that will be looked up.
84+
/// \param lookupKind Whether this lookup is qualified or unqualified.
85+
/// \param resolutionKind What sort of decl is expected.
7186
LookupByName(ASTContext &ctx, ResolutionKind resolutionKind,
7287
DeclName name, NLKind lookupKind)
7388
: Super(ctx, resolutionKind), name(name),
@@ -80,6 +95,10 @@ class LookupByName : public ModuleNameLookup<LookupByName> {
8095
return true;
8196
}
8297

98+
/// \param module The module to search for declarations in.
99+
/// \param path The access path that was imported; if not empty, only the
100+
/// named declaration will be imported.
101+
/// \param[out] localDecls Results are appended to this vector.
83102
void doLocalLookup(ModuleDecl *module, ImportPath::Access path,
84103
SmallVectorImpl<ValueDecl *> &localDecls) {
85104
// If this import is specific to some named decl ("import Swift.Int")

0 commit comments

Comments
 (0)