mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Switch types to a SemanticsTypeId. (#2854)
This switches types to using SemanticsTypeId instead of SemanticsNodeId, and lowering pre-builds its list of types. The empty tuple type is special-cased because we don't want to emit it unless it's in-use, but as the implicit return for functions, it's frequently used. Callables use invalid to indicate the implicit return, and that seems undesirable to change due to the size increase.
This commit is contained in:
@@ -19,9 +19,15 @@ auto SemanticsNodeStack::PushEntry(Entry entry, DebugLog debug_log) -> void {
|
||||
case DebugLog::NodeId:
|
||||
CARBON_VLOG() << entry.node_id;
|
||||
break;
|
||||
case DebugLog::NodeBlockId:
|
||||
CARBON_VLOG() << entry.node_block_id;
|
||||
break;
|
||||
case DebugLog::NameId:
|
||||
CARBON_VLOG() << entry.name_id;
|
||||
break;
|
||||
case DebugLog::TypeId:
|
||||
CARBON_VLOG() << entry.type_id;
|
||||
break;
|
||||
}
|
||||
CARBON_VLOG() << "\n";
|
||||
CARBON_CHECK(stack_.size() < (1 << 20))
|
||||
@@ -137,6 +143,13 @@ auto SemanticsNodeStack::PopForNodeBlockId(ParseNodeKind pop_parse_kind)
|
||||
return back.node_block_id;
|
||||
}
|
||||
|
||||
auto SemanticsNodeStack::PopForTypeId(ParseNodeKind pop_parse_kind)
|
||||
-> SemanticsTypeId {
|
||||
auto back = PopEntry(pop_parse_kind);
|
||||
RequireValidId(back);
|
||||
return back.type_id;
|
||||
}
|
||||
|
||||
auto SemanticsNodeStack::PopForParseNodeAndNameId(ParseNodeKind pop_parse_kind)
|
||||
-> std::pair<ParseTree::Node, SemanticsStringId> {
|
||||
auto back = PopEntry(pop_parse_kind);
|
||||
|
||||
Reference in New Issue
Block a user