mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 08:51:04 +01:00
Consolidate post-check logic (#5003)
Right now, some post-run logic is does in `Run()` (`CheckRequiredDefinitions();` and `context_.sem_ir().set_has_errors(unit_and_imports_->err_tracker.seen_error());`) whereas other parts are done by `Finalize`. Noting the goal to move things off `Context`, this consolidates into a new `FinishRun`. Note #4962 is adding another bit of post-run that can be consolidated in; this seems likely to keep growing slowly. Note this also creates more parity with mutation source, like the `context_.scope_stack().Pop();` matches the push done by `CheckUnit::ImportCurrentPackage` and `context_.inst_block_stack().Pop()` was pushed in `CheckUnit::Run()`. Also makes `exports()` more consistent with other Context APIs. Makes `VerifyOnFinish` `const` so that it can't accidentally mutate state, and is instead only validating that the Context is in its expected configuration at completion.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace Carbon::Check {
|
||||
|
||||
auto ScopeStack::VerifyOnFinish() -> void {
|
||||
auto ScopeStack::VerifyOnFinish() const -> void {
|
||||
CARBON_CHECK(scope_stack_.empty(), "{0}", scope_stack_.size());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user