mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Put check stage handle functions in execution order (#3573)
No changes other than moving code and adding section comments.
This commit is contained in:
@@ -7,9 +7,16 @@
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
auto HandleStructComma(Context& context, Parse::StructCommaId /*parse_node*/)
|
||||
auto HandleStructLiteralOrStructTypeLiteralStart(
|
||||
Context& context, Parse::StructLiteralOrStructTypeLiteralStartId parse_node)
|
||||
-> bool {
|
||||
context.ParamOrArgComma();
|
||||
context.PushScope();
|
||||
context.node_stack().Push(parse_node);
|
||||
// At this point we aren't sure whether this will be a value or type literal,
|
||||
// so we push onto args irrespective. It just won't be used for a type
|
||||
// literal.
|
||||
context.args_type_info_stack().Push();
|
||||
context.ParamOrArgStart();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -21,15 +28,9 @@ auto HandleStructFieldDesignator(Context& context,
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleStructFieldType(Context& context,
|
||||
Parse::StructFieldTypeId parse_node) -> bool {
|
||||
auto [type_node, type_id] = context.node_stack().PopExprWithParseNode();
|
||||
SemIR::TypeId cast_type_id = ExprAsType(context, type_node, type_id);
|
||||
|
||||
auto [name_node, name_id] = context.node_stack().PopNameWithParseNode();
|
||||
|
||||
context.AddInstAndPush(
|
||||
parse_node, SemIR::StructTypeField{name_node, name_id, cast_type_id});
|
||||
auto HandleStructComma(Context& context, Parse::StructCommaId /*parse_node*/)
|
||||
-> bool {
|
||||
context.ParamOrArgComma();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -47,6 +48,18 @@ auto HandleStructFieldValue(Context& context,
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleStructFieldType(Context& context,
|
||||
Parse::StructFieldTypeId parse_node) -> bool {
|
||||
auto [type_node, type_id] = context.node_stack().PopExprWithParseNode();
|
||||
SemIR::TypeId cast_type_id = ExprAsType(context, type_node, type_id);
|
||||
|
||||
auto [name_node, name_id] = context.node_stack().PopNameWithParseNode();
|
||||
|
||||
context.AddInstAndPush(
|
||||
parse_node, SemIR::StructTypeField{name_node, name_id, cast_type_id});
|
||||
return true;
|
||||
}
|
||||
|
||||
static auto DiagnoseDuplicateNames(Context& context,
|
||||
SemIR::InstBlockId type_block_id,
|
||||
llvm::StringRef construct) -> bool {
|
||||
@@ -98,19 +111,6 @@ auto HandleStructLiteral(Context& context, Parse::StructLiteralId parse_node)
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleStructLiteralOrStructTypeLiteralStart(
|
||||
Context& context, Parse::StructLiteralOrStructTypeLiteralStartId parse_node)
|
||||
-> bool {
|
||||
context.PushScope();
|
||||
context.node_stack().Push(parse_node);
|
||||
// At this point we aren't sure whether this will be a value or type literal,
|
||||
// so we push onto args irrespective. It just won't be used for a type
|
||||
// literal.
|
||||
context.args_type_info_stack().Push();
|
||||
context.ParamOrArgStart();
|
||||
return true;
|
||||
}
|
||||
|
||||
auto HandleStructTypeLiteral(Context& context,
|
||||
Parse::StructTypeLiteralId parse_node) -> bool {
|
||||
auto refs_id = context.ParamOrArgEnd(
|
||||
|
||||
Reference in New Issue
Block a user