Change Context::IsImplFile to File::is_impl (#4931)

Note this mirrors parse_tree().packaging_decl().is_impl, but I'm
preferring to keep the version that doesn't access the parse tree so
that we could change tree storage without hurting as much.
This commit is contained in:
Jon Ross-Perkins
2025-02-12 19:42:07 +00:00
committed by GitHub
parent 71c91eaf14
commit 8af64ceca6
9 changed files with 35 additions and 32 deletions
+4 -2
View File
@@ -10,6 +10,7 @@
#include "toolchain/check/eval.h"
#include "toolchain/check/generic.h"
#include "toolchain/check/handle.h"
#include "toolchain/check/import.h"
#include "toolchain/check/import_ref.h"
#include "toolchain/check/merge.h"
#include "toolchain/check/modifiers.h"
@@ -265,7 +266,7 @@ static auto BuildClassDecl(Context& context, Parse::AnyClassDeclId node_id,
.specific_id = specific_id}));
}
if (!is_definition && context.IsImplFile() && !is_extern) {
if (!is_definition && context.sem_ir().is_impl() && !is_extern) {
context.definitions_required().push_back(class_decl_id);
}
@@ -333,7 +334,8 @@ static auto DiagnoseClassSpecificDeclOutsideClass(Context& context,
static auto GetCurrentScopeAsClassOrDiagnose(Context& context, SemIRLoc loc,
Lex::TokenKind tok)
-> std::optional<SemIR::ClassDecl> {
auto class_scope = context.GetCurrentScopeAs<SemIR::ClassDecl>();
auto class_scope =
context.scope_stack().GetCurrentScopeAs<SemIR::ClassDecl>();
if (!class_scope) {
DiagnoseClassSpecificDeclOutsideClass(context, loc, tok);
}