Add value store to be shared across compile stages. (#3311)

This updates lexing to use the data. I'll do checking separately, just
to split changes.

Note the ValueStore structure is also set up such that SemIR::File can
use it for other fields.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
Jon Ross-Perkins
2023-10-20 15:00:53 +00:00
committed by GitHub
co-authored by Richard Smith
parent 629c63c7d1
commit d13f76e001
26 changed files with 389 additions and 227 deletions
+3 -4
View File
@@ -13,7 +13,7 @@ auto DeclarationNameStack::MakeEmptyNameContext() -> NameContext {
}
auto DeclarationNameStack::MakeUnqualifiedName(Parse::Node parse_node,
SemIR::StringId name_id)
StringId name_id)
-> NameContext {
NameContext context = MakeEmptyNameContext();
ApplyNameQualifierTo(context, parse_node, name_id);
@@ -106,14 +106,13 @@ auto DeclarationNameStack::ApplyExpressionQualifier(Parse::Node parse_node,
}
auto DeclarationNameStack::ApplyNameQualifier(Parse::Node parse_node,
SemIR::StringId name_id) -> void {
StringId name_id) -> void {
ApplyNameQualifierTo(declaration_name_stack_.back(), parse_node, name_id);
}
auto DeclarationNameStack::ApplyNameQualifierTo(NameContext& name_context,
Parse::Node parse_node,
SemIR::StringId name_id)
-> void {
StringId name_id) -> void {
if (CanResolveQualifier(name_context, parse_node)) {
// For identifier nodes, we need to perform a lookup on the identifier.
// This means the input node_id is actually a string ID.