Move import refs to their own block. (#4103)

This executes on a TODO in AddImportRef to add instructions to their own
block instead of the File block. This has an important consequence of
removing a pattern from InstBlockStack that added to blocks not
currently at the top, cleaning up an issue for ArrayStack. The delta
here is then mostly in different formatting of the import refs, a
consequence of the separation.
This commit is contained in:
Jon Ross-Perkins
2024-07-03 18:21:12 +00:00
committed by GitHub
parent 00a1559c01
commit 9581a1867d
384 changed files with 5593 additions and 3769 deletions
+13
View File
@@ -633,6 +633,19 @@ auto Context::is_current_position_reachable() -> bool {
SemIR::TerminatorKind::Terminator;
}
auto Context::Finalize() -> void {
// Pop information for the file-level scope.
sem_ir().set_top_inst_block_id(inst_block_stack().Pop());
scope_stack().Pop();
// Finalizes the list of exports on the IR.
inst_blocks().Set(SemIR::InstBlockId::Exports, exports_);
// Finalizes the ImportRef inst block.
inst_blocks().Set(SemIR::InstBlockId::ImportRefs, import_ref_ids_);
// Finalizes __global_init.
global_init_.Finalize();
}
namespace {
// Worklist-based type completion mechanism.
//