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:
@@ -34,11 +34,14 @@ auto SemanticsHandleFunctionDefinition(SemanticsContext& context,
|
||||
auto SemanticsHandleFunctionDefinitionStart(SemanticsContext& context,
|
||||
ParseTree::Node parse_node)
|
||||
-> bool {
|
||||
SemanticsNodeId return_type_id = SemanticsNodeId::Invalid;
|
||||
SemanticsTypeId return_type_id = SemanticsTypeId::Invalid;
|
||||
if (context.parse_tree().node_kind(context.node_stack().PeekParseNode()) ==
|
||||
ParseNodeKind::ReturnType) {
|
||||
return_type_id =
|
||||
context.node_stack().PopForNodeId(ParseNodeKind::ReturnType);
|
||||
context.node_stack().PopForTypeId(ParseNodeKind::ReturnType);
|
||||
} else {
|
||||
// Canonicalize the empty tuple for the implicit return.
|
||||
context.CanonicalizeType(SemanticsNodeId::BuiltinEmptyTupleType);
|
||||
}
|
||||
auto param_refs_id =
|
||||
context.node_stack().PopForNodeBlockId(ParseNodeKind::ParameterList);
|
||||
|
||||
Reference in New Issue
Block a user