Skip to content

Commit a460fb5

Browse files
authored
NFC: Rename NameBinding to ImportResolution (swiftlang#30717)
NFC: Rename NameBinding to ImportResolution
2 parents 88af7bf + 5b99c20 commit a460fb5

File tree

150 files changed

+327
-331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+327
-331
lines changed

docs/CompilerPerformance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ compilers on hand while you're working.
570570
Total Execution Time: 0.0876 seconds (0.0877 wall clock)
571571
572572
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
573-
0.0241 ( 53.9%) 0.0394 ( 92.0%) 0.0635 ( 72.5%) 0.0635 ( 72.5%) Name binding
573+
0.0241 ( 53.9%) 0.0394 ( 92.0%) 0.0635 ( 72.5%) 0.0635 ( 72.5%) Import resolution
574574
0.0170 ( 38.0%) 0.0025 ( 5.8%) 0.0195 ( 22.3%) 0.0195 ( 22.2%) Type checking / Semantic analysis
575575
0.0013 ( 3.0%) 0.0004 ( 0.8%) 0.0017 ( 1.9%) 0.0017 ( 1.9%) LLVM output
576576
0.0010 ( 2.3%) 0.0003 ( 0.7%) 0.0013 ( 1.5%) 0.0013 ( 1.5%) SILGen

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ NOTE(add_return_type_note,none,
661661
"did you mean to add a return type?", ())
662662

663663
//------------------------------------------------------------------------------
664-
// MARK: Name Binding
664+
// MARK: Import Resolution
665665
//------------------------------------------------------------------------------
666666

667667
ERROR(sema_no_import,Fatal,

include/swift/AST/Expr.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,9 +1333,9 @@ class SuperRefExpr : public Expr {
13331333
}
13341334
};
13351335

1336-
/// A reference to a type in expression context, spelled out as a TypeLoc. Sema
1337-
/// forms this expression as a result of name binding. This always has
1338-
/// MetaTypetype.
1336+
/// A reference to a type in expression context, spelled out as a TypeLoc.
1337+
///
1338+
/// The type of this expression is always \c MetaTypeType.
13391339
class TypeExpr : public Expr {
13401340
TypeLoc Info;
13411341
TypeExpr(Type Ty);
@@ -4831,7 +4831,7 @@ class AssignExpr : public Expr {
48314831
};
48324832

48334833
/// A pattern production that has been parsed but hasn't been resolved
4834-
/// into a complete pattern. Name binding converts these into standalone pattern
4834+
/// into a complete pattern. Pattern checking converts these into standalone pattern
48354835
/// nodes or raises an error if a pattern production appears in an invalid
48364836
/// position.
48374837
class UnresolvedPatternExpr : public Expr {

include/swift/AST/ImportCache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class alignas(ModuleDecl::ImportedModule) ImportCache {
148148
const DeclContext *dc);
149149

150150
/// This is a hack to cope with main file parsing and REPL parsing, where
151-
/// we can add ImportDecls after name binding.
151+
/// we can add ImportDecls after import resolution.
152152
void clear() {
153153
ImportSetForDC.clear();
154154
}

include/swift/AST/SourceFile.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ class PersistentParserState;
2323
/// A file containing Swift source code.
2424
///
2525
/// This is a .swift or .sil file (or a virtual file, such as the contents of
26-
/// the REPL). Since it contains raw source, it must be parsed and name-bound
27-
/// before being used for anything; a full type-check is also necessary for
28-
/// IR generation.
26+
/// the REPL). Since it contains raw source, it must be type checked for IR
27+
/// generation.
2928
class SourceFile final : public FileUnit {
3029
friend class ParseSourceFileRequest;
3130

@@ -128,7 +127,7 @@ class SourceFile final : public FileUnit {
128127

129128
/// This is the list of modules that are imported by this module.
130129
///
131-
/// This is filled in by the Name Binding phase.
130+
/// This is filled in by the import resolution phase.
132131
ArrayRef<ImportedModuleDesc> Imports;
133132

134133
/// A unique identifier representing this file; used to mark private decls
@@ -316,10 +315,10 @@ class SourceFile final : public FileUnit {
316315
const SourceFileKind Kind;
317316

318317
enum ASTStage_t {
319-
/// The source file is not name bound or type checked.
318+
/// The source file has not had its imports resolved or been type checked.
320319
Unprocessed,
321-
/// Name binding has completed.
322-
NameBound,
320+
/// Import resolution has completed.
321+
ImportsResolved,
323322
/// Type checking has completed.
324323
TypeChecked
325324
};

include/swift/AST/TypeRepr.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ class ComponentIdentTypeRepr : public IdentTypeRepr {
263263
/// component.
264264
///
265265
/// The initial parsed representation is always an identifier, and
266-
/// name binding will resolve this to a specific declaration.
266+
/// name lookup will resolve this to a specific declaration.
267267
llvm::PointerUnion<DeclNameRef, TypeDecl *> IdOrDecl;
268268

269269
/// The declaration context from which the bound declaration was
@@ -282,7 +282,8 @@ class ComponentIdentTypeRepr : public IdentTypeRepr {
282282
/// correction.
283283
void overwriteNameRef(DeclNameRef newId) { IdOrDecl = newId; }
284284

285-
/// Return true if this has been name-bound already.
285+
/// Return true if this name has been resolved to a type decl. This happens
286+
/// during type resolution.
286287
bool isBound() const { return IdOrDecl.is<TypeDecl *>(); }
287288

288289
TypeDecl *getBoundDecl() const { return IdOrDecl.dyn_cast<TypeDecl*>(); }

include/swift/AST/Types.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,10 +1271,11 @@ class NominalOrBoundGenericNominalType : public AnyGenericType {
12711271
};
12721272
DEFINE_EMPTY_CAN_TYPE_WRAPPER(NominalOrBoundGenericNominalType, AnyGenericType)
12731273

1274-
/// ErrorType - This represents a type that was erroneously constructed. This
1275-
/// is produced when parsing types and when name binding type aliases, and is
1276-
/// installed in declaration that use these erroneous types. All uses of a
1277-
/// declaration of invalid type should be ignored and not re-diagnosed.
1274+
/// ErrorType - Represents the type of an erroneously constructed declaration,
1275+
/// expression, or type. When creating ErrorTypes, an associated error
1276+
/// diagnostic should always be emitted. That way when later stages of
1277+
/// compilation encounter an ErrorType installed by earlier phases they do not
1278+
/// have to emit further diagnostics to abort compilation.
12781279
class ErrorType final : public TypeBase {
12791280
friend class ASTContext;
12801281
// The Error type is always canonical.
@@ -6410,11 +6411,11 @@ inline ArrayRef<AnyFunctionType::Param> AnyFunctionType::getParams() const {
64106411
llvm_unreachable("Undefined function type");
64116412
}
64126413
}
6413-
6414+
64146415
/// If this is a method in a type or extension thereof, compute
64156416
/// and return a parameter to be used for the 'self' argument. The type of
64166417
/// the parameter is the empty Type() if no 'self' argument should exist. This
6417-
/// can only be used after name binding has resolved types.
6418+
/// can only be used after types have been resolved.
64186419
///
64196420
/// \param isInitializingCtor Specifies whether we're computing the 'self'
64206421
/// type of an initializing constructor, which accepts an instance 'self'

include/swift/Frontend/Frontend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ class CompilerInstance {
623623
void performParseOnly(bool EvaluateConditionals = false,
624624
bool CanDelayBodies = true);
625625

626-
/// Parses and performs name binding on all input files.
626+
/// Parses and performs import resolution on all input files.
627627
///
628628
/// This is similar to a parse-only invocation, but module imports will also
629629
/// be processed.

include/swift/Parse/Scope.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ inline ValueDecl *ScopeInfo::lookupValueName(DeclNameRef Name) {
170170
assert(CurScope && "no scope");
171171
// If we found nothing, or we found a decl at the top-level, return nothing.
172172
// We ignore results at the top-level because we may have overloading that
173-
// will be resolved properly by name binding.
173+
// will be resolved properly by name lookup.
174174
std::pair<unsigned, ValueDecl *> Res = HT.lookup(CurScope->HTScope,
175175
Name.getFullName());
176176
if (Res.first < ResolvableDepth)

include/swift/Subsystems.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,33 +118,32 @@ namespace swift {
118118
bool TokenizeInterpolatedString = true,
119119
ArrayRef<Token> SplitTokens = ArrayRef<Token>());
120120

121-
/// Once parsing is complete, this walks the AST to resolve imports, record
122-
/// operators, and do other top-level validation.
123-
void performNameBinding(SourceFile &SF);
121+
/// This walks the AST to resolve imports.
122+
void performImportResolution(SourceFile &SF);
124123

125124
/// Once type-checking is complete, this instruments code with calls to an
126125
/// intrinsic that record the expected values of local variables so they can
127126
/// be compared against the results from the debugger.
128127
void performDebuggerTestingTransform(SourceFile &SF);
129128

130-
/// Once parsing and name-binding are complete, this optionally transforms the
131-
/// ASTs to add calls to external logging functions.
129+
/// Once type checking is complete, this optionally transforms the ASTs to add
130+
/// calls to external logging functions.
132131
///
133132
/// \param HighPerformance True if the playground transform should omit
134133
/// instrumentation that has a high runtime performance impact.
135134
void performPlaygroundTransform(SourceFile &SF, bool HighPerformance);
136135

137-
/// Once parsing and name-binding are complete this optionally walks the ASTs
138-
/// to add calls to externally provided functions that simulate
139-
/// "program counter"-like debugging events. See the comment at the top of
140-
/// lib/Sema/PCMacro.cpp for a description of the calls inserted.
136+
/// Once type checking is complete this optionally walks the ASTs to add calls
137+
/// to externally provided functions that simulate "program counter"-like
138+
/// debugging events. See the comment at the top of lib/Sema/PCMacro.cpp for a
139+
/// description of the calls inserted.
141140
void performPCMacro(SourceFile &SF);
142141

143142
/// Bind all 'extension' visible from \p SF to the extended nominal.
144143
void bindExtensions(SourceFile &SF);
145144

146-
/// Once parsing and name-binding are complete, this walks the AST to resolve
147-
/// types and diagnose problems therein.
145+
/// Once import resolution is complete, this walks the AST to resolve types
146+
/// and diagnose problems therein.
148147
void performTypeChecking(SourceFile &SF);
149148

150149
/// Now that we have type-checked an entire module, perform any type

0 commit comments

Comments
 (0)