/
githubmirror
/
carbon-lang
Обзор
Документация
Войти
/
githubmirror
/
carbon-lang
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
toolchain/check/name_scope.cpp
25 строк
770 B
Dana Jansens
Diagnose explicit `Self` in extend in the parse node handler (Refactor Impl construction 1/7) (#6465)
09 дек 2025, 23:38
Не верифицирован
09 дек 2025, 23:38
2d38978
Код
Авторство
О чём код?
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM // Exceptions. See /LICENSE for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception #include "toolchain/check/name_scope.h" namespace Carbon::Check { auto TryAsClassScope(Context& context, SemIR::NameScopeId scope_id) -> std::optional<ClassScope> { if (!scope_id.has_value()) { return std::nullopt; } auto& scope = context.name_scopes().Get(scope_id); if (!scope.inst_id().has_value()) { return std::nullopt; } auto class_decl = context.insts().TryGetAs<SemIR::ClassDecl>(scope.inst_id()); if (!class_decl) { return std::nullopt; } return {{.class_decl = *class_decl, .name_scope = &scope}}; } } // namespace Carbon::Check