mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Rename enclosing scope to parent scope (#4020)
Following up on discussion from #3948, doing a general rename of "enclosing scope" to "parent scope" (and "enclosing scopes" to "ancestor scopes"). The intent is to improve understandability and collide less with C++ terminology for "enclosing scope". Note this changes most uses of "enclosing", but leaves behind a few like "enclosing function" and "enclosing block". Note this does create some "parent class" mentions for "adapt" and "var" (the class they're within), which is maybe unfortunate, but we'd probably say "base class" if we meant inheritance so perhaps that's okay. Along the same lines, these are the only `parent_class` uses I see now, and we do have a few `base_class`.
This commit is contained in:
@@ -252,10 +252,10 @@ auto Context::LookupUnqualifiedName(Parse::NodeId node_id,
|
||||
SemIR::NameId name_id) -> SemIR::InstId {
|
||||
// TODO: Check for shadowed lookup results.
|
||||
|
||||
// Find the results from enclosing lexical scopes. These will be combined with
|
||||
// Find the results from ancestor lexical scopes. These will be combined with
|
||||
// results from non-lexical scopes such as namespaces and classes.
|
||||
auto [lexical_result, non_lexical_scopes] =
|
||||
scope_stack().LookupInEnclosingScopes(name_id);
|
||||
scope_stack().LookupInLexicalScopes(name_id);
|
||||
|
||||
// Walk the non-lexical scopes and perform lookups into each of them.
|
||||
for (auto [index, name_scope_id] : llvm::reverse(non_lexical_scopes)) {
|
||||
@@ -340,7 +340,7 @@ static auto LookupInImportIRScopes(Context& context, SemIRLoc loc,
|
||||
// Add the first result found.
|
||||
auto bind_name_id = context.bind_names().Add(
|
||||
{.name_id = name_id,
|
||||
.enclosing_scope_id = scope_id,
|
||||
.parent_scope_id = scope_id,
|
||||
.bind_index = SemIR::CompileTimeBindIndex::Invalid});
|
||||
result_id =
|
||||
AddImportRef(context, {.ir_id = import_ir_id, .inst_id = it->second},
|
||||
@@ -567,7 +567,6 @@ auto Context::SetBlockArgResultBeforeConstantUse(SemIR::InstId select_id,
|
||||
}
|
||||
}
|
||||
|
||||
// Add the current code block to the enclosing function.
|
||||
auto Context::AddCurrentCodeBlockToFunction(Parse::NodeId node_id) -> void {
|
||||
CARBON_CHECK(!inst_block_stack().empty()) << "no current code block";
|
||||
|
||||
@@ -621,7 +620,7 @@ auto Context::FinalizeGlobalInit() -> void {
|
||||
auto name_id = sem_ir().identifiers().Add("__global_init");
|
||||
sem_ir().functions().Add(
|
||||
{.name_id = SemIR::NameId::ForIdentifier(name_id),
|
||||
.enclosing_scope_id = SemIR::NameScopeId::Package,
|
||||
.parent_scope_id = SemIR::NameScopeId::Package,
|
||||
.decl_id = SemIR::InstId::Invalid,
|
||||
.implicit_param_refs_id = SemIR::InstBlockId::Invalid,
|
||||
.param_refs_id = SemIR::InstBlockId::Empty,
|
||||
|
||||
Reference in New Issue
Block a user