mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 13:41:06 +01:00
Move control flow block functions to their own file. (#4921)
context.cpp is getting large, so I'm looking at a few ways to cut out clusters of functions. This felt like a logical cluster of functions to move to their own file. Note this doesn't touch the implementation at all, beyond what's needed to change from `Context` members to context args.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
#include "toolchain/check/context.h"
|
||||
#include "toolchain/check/control_flow.h"
|
||||
#include "toolchain/check/convert.h"
|
||||
#include "toolchain/check/handle.h"
|
||||
|
||||
@@ -22,8 +23,8 @@ auto HandleParseNode(Context& context, Parse::IfConditionId node_id) -> bool {
|
||||
// there is no `else`, the then block will terminate with a branch to the
|
||||
// else block, which will be reused as the resumption block.
|
||||
auto then_block_id =
|
||||
context.AddDominatedBlockAndBranchIf(node_id, cond_value_id);
|
||||
auto else_block_id = context.AddDominatedBlockAndBranch(node_id);
|
||||
AddDominatedBlockAndBranchIf(context, node_id, cond_value_id);
|
||||
auto else_block_id = AddDominatedBlockAndBranch(context, node_id);
|
||||
|
||||
// Start emitting the `then` block.
|
||||
context.inst_block_stack().Pop();
|
||||
@@ -64,7 +65,7 @@ auto HandleParseNode(Context& context, Parse::IfStatementId node_id) -> bool {
|
||||
// Branch from the then and else blocks to a new resumption block.
|
||||
context.node_stack()
|
||||
.PopAndDiscardSoloNodeId<Parse::NodeKind::IfStatementElse>();
|
||||
context.AddConvergenceBlockAndPush(node_id, /*num_blocks=*/2);
|
||||
AddConvergenceBlockAndPush(context, node_id, /*num_blocks=*/2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user