Make NamedEntityInterface non-movable (#946)

This commit is contained in:
Geoff Romer
2021-11-10 09:33:00 -08:00
committed by GitHub
parent e8d9b7675b
commit a9bb06ca14
10 changed files with 82 additions and 61 deletions
@@ -133,8 +133,8 @@ void PopulateNamesInDeclaration(Arena* arena, Declaration& declaration,
case Declaration::Kind::FunctionDeclaration: {
auto& func = cast<FunctionDeclaration>(declaration);
static_scope.Add(func.name(), &declaration);
for (const auto& param : func.deduced_parameters()) {
func.static_scope().Add(param.name(), &param);
for (Nonnull<const GenericBinding*> param : func.deduced_parameters()) {
func.static_scope().Add(param->name(), param);
}
PopulateNamesInPattern(func.param_pattern(), func.static_scope());
PopulateNamesInStatement(arena, func.body(), static_scope);
@@ -151,8 +151,9 @@ void PopulateNamesInDeclaration(Arena* arena, Declaration& declaration,
case Declaration::Kind::ChoiceDeclaration: {
auto& choice = cast<ChoiceDeclaration>(declaration);
static_scope.Add(choice.name(), &declaration);
for (auto& alt : choice.alternatives()) {
choice.static_scope().Add(alt.name(), &alt);
for (Nonnull<const ChoiceDeclaration::Alternative*> alt :
choice.alternatives()) {
choice.static_scope().Add(alt->name(), alt);
}
// Populate name into declared_names.
// Init the choice's declared_names, and populate it with the