mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 10:11:06 +01:00
Formalize Cpp as a PackageNameId (#6306)
This turns `Cpp` into a keyword, and makes it map to `NameId::Cpp` and `PackageNameId::Cpp`. Per discussion with zygoloid, the keyword versus identifier question is deliberately kept open by #4846. This PR switches to a keyword because mapping to a specific `PackageNameId` works best with a special `NameId` not backed by an `IdentifierId`. We could in theory make it work using `IdentifierId` or a runtime-tracked `PackageNameId` for `Cpp` (e.g. stored on `SemIR::File`), but this approach is consistent with `Core` and so seemed like a good starting point. --------- Co-authored-by: Dana Jansens <danakj@orodu.net>
This commit is contained in:
co-authored by
Dana Jansens
parent
ae50e0f623
commit
8166f9a7cf
@@ -180,6 +180,11 @@ auto HandleExprInPostfix(Context& context) -> void {
|
||||
context.PushState(state);
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::Cpp: {
|
||||
context.AddLeafNode(NodeKind::CppNameExpr, context.Consume());
|
||||
context.PushState(state);
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::SelfValueIdentifier: {
|
||||
context.AddLeafNode(NodeKind::SelfValueNameExpr, context.Consume());
|
||||
context.PushState(state);
|
||||
|
||||
Reference in New Issue
Block a user