mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 17:38:14 +00:00
Part of switching to the [abbreviations we've decided to use](https://docs.google.com/document/d/1RRYMm42osyqhI2LyjrjockYCutQ5dOf8Abu50kTrkX0/edit?resourcekey=0-kHyqOESbOHmzZphUbtLrTw#heading=h.pph7i5m5un7q). I will rename files in a follow-up PR.
27 lines
916 B
C++
27 lines
916 B
C++
// 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/context.h"
|
|
#include "toolchain/sem_ir/inst.h"
|
|
|
|
namespace Carbon::Check {
|
|
|
|
auto HandleNamespaceStart(Context& context, Parse::Node /*parse_node*/)
|
|
-> bool {
|
|
context.decl_name_stack().PushScopeAndStartName();
|
|
return true;
|
|
}
|
|
|
|
auto HandleNamespace(Context& context, Parse::Node parse_node) -> bool {
|
|
auto name_context = context.decl_name_stack().FinishName();
|
|
auto namespace_id = context.AddInst(SemIR::Namespace{
|
|
parse_node, context.GetBuiltinType(SemIR::BuiltinKind::NamespaceType),
|
|
context.name_scopes().Add()});
|
|
context.decl_name_stack().AddNameToLookup(name_context, namespace_id);
|
|
context.decl_name_stack().PopScope();
|
|
return true;
|
|
}
|
|
|
|
} // namespace Carbon::Check
|