mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Clean up interface of node block stack after recent changes. (#3229)
- `Peek()` no longer returns a useful value, because we often don't allocate a `NodeBlockId` until we finish building the block. Remove it and update both its callers. - Rename `PeekForAdd()` to `PeekOrAdd()` since it's no longer used to get a block ID to add elements into. - `PushForAdd()` was unused. Remove it. - Add `NodeBlockStack::AddNode` to combine the operations of adding a node and inserting it into a block.
This commit is contained in:
@@ -51,11 +51,9 @@ auto HandleStructFieldValue(Context& context, Parse::Node parse_node) -> bool {
|
||||
value_node_id = context.ConvertToValueExpression(value_node_id);
|
||||
|
||||
// Store the name for the type.
|
||||
context.args_type_info_stack().AddNodeId(
|
||||
context.semantics_ir().AddNodeInNoBlock(
|
||||
SemIR::Node::StructTypeField::Make(
|
||||
parse_node, name_id,
|
||||
context.semantics_ir().GetNode(value_node_id).type_id())));
|
||||
context.args_type_info_stack().AddNode(SemIR::Node::StructTypeField::Make(
|
||||
parse_node, name_id,
|
||||
context.semantics_ir().GetNode(value_node_id).type_id()));
|
||||
|
||||
// Push the value back on the stack as an argument.
|
||||
context.node_stack().Push(parse_node, value_node_id);
|
||||
|
||||
Reference in New Issue
Block a user