mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Change Alternative to a class (#853)
Revives BisonWrap because this seems a reasonable use of it (avoiding the need to have an std::optional or pointer for Alternative, both of which I thought could be unclear about the intent).
This commit is contained in:
@@ -151,9 +151,9 @@ void Interpreter::InitEnv(const Declaration& d, Env* env) {
|
||||
case Declaration::Kind::ChoiceDeclaration: {
|
||||
const auto& choice = cast<ChoiceDeclaration>(d);
|
||||
VarValues alts;
|
||||
for (const auto& [name, signature] : choice.Alternatives()) {
|
||||
auto t = InterpExp(Env(arena), signature);
|
||||
alts.push_back(make_pair(name, t));
|
||||
for (const auto& alternative : choice.Alternatives()) {
|
||||
auto t = InterpExp(Env(arena), &alternative.signature());
|
||||
alts.push_back(make_pair(alternative.name(), t));
|
||||
}
|
||||
auto ct = arena->New<ChoiceType>(choice.Name(), std::move(alts));
|
||||
auto a = heap.AllocateValue(ct);
|
||||
|
||||
Reference in New Issue
Block a user