mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 21:20:11 +01:00
Instead of building an eval block as a separate pass at the end of a generic, build the eval block incrementally. The larger change here is that asking for the type or constant value of an instruction now always returns an unattached type or constant value, in order to preserve the behavior that we previously achieved by doing the rewrite to attached types and constant values at the end of handling the generic. This also incidentally fixes some subtle issues where attached types and constant values would leak out into check and cause it to get confused about differences between attached and unattached values. Check should no longer see attached values except where it explicitly asks for them. --------- Co-authored-by: Dana Jansens <danakj@orodu.net>
24 lines
732 B
C++
24 lines
732 B
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#include "toolchain/check/generic_region_stack.h"
|
|
|
|
namespace Carbon::Check {
|
|
|
|
auto GenericRegionStack::Push(PendingGeneric generic) -> void {
|
|
pending_generic_ids_.push_back(generic);
|
|
pending_eval_block_stack_.PushArray();
|
|
dependent_inst_stack_.PushArray();
|
|
constants_in_generic_stack_.emplace_back();
|
|
}
|
|
|
|
auto GenericRegionStack::Pop() -> void {
|
|
pending_generic_ids_.pop_back();
|
|
pending_eval_block_stack_.PopArray();
|
|
dependent_inst_stack_.PopArray();
|
|
constants_in_generic_stack_.pop_back();
|
|
}
|
|
|
|
} // namespace Carbon::Check
|