Implement rename me -> self (#2444)

Implements change proposed in #1382

Replaces #1624
This commit is contained in:
josh11b
2022-12-06 20:17:00 -08:00
committed by GitHub
parent d1210c4a50
commit 9c8fd6864e
287 changed files with 1727 additions and 1720 deletions
+20 -18
View File
@@ -584,21 +584,22 @@ static auto DeclarationToProto(const Declaration& declaration)
const auto& function = cast<DestructorDeclaration>(declaration);
auto* function_proto = declaration_proto.mutable_destructor();
if (function.is_method()) {
switch (function.me_pattern().kind()) {
switch (function.self_pattern().kind()) {
case PatternKind::AddrPattern:
*function_proto->mutable_me_pattern() =
PatternToProto(cast<AddrPattern>(function.me_pattern()));
*function_proto->mutable_self_pattern() =
PatternToProto(cast<AddrPattern>(function.self_pattern()));
break;
case PatternKind::BindingPattern:
*function_proto->mutable_me_pattern() =
PatternToProto(cast<BindingPattern>(function.me_pattern()));
*function_proto->mutable_self_pattern() =
PatternToProto(cast<BindingPattern>(function.self_pattern()));
break;
default:
// Parser shouldn't allow me_pattern to be anything other than
// Parser shouldn't allow self_pattern to be anything other than
// AddrPattern or BindingPattern
CARBON_FATAL() << "me_pattern in method declaration can be either "
"AddrPattern or BindingPattern. Actual pattern: "
<< function.me_pattern();
CARBON_FATAL()
<< "self_pattern in method declaration can be either "
"AddrPattern or BindingPattern. Actual pattern: "
<< function.self_pattern();
break;
}
}
@@ -619,21 +620,22 @@ static auto DeclarationToProto(const Declaration& declaration)
GenericBindingToProto(*binding);
}
if (function.is_method()) {
switch (function.me_pattern().kind()) {
switch (function.self_pattern().kind()) {
case PatternKind::AddrPattern:
*function_proto->mutable_me_pattern() =
PatternToProto(cast<AddrPattern>(function.me_pattern()));
*function_proto->mutable_self_pattern() =
PatternToProto(cast<AddrPattern>(function.self_pattern()));
break;
case PatternKind::BindingPattern:
*function_proto->mutable_me_pattern() =
PatternToProto(cast<BindingPattern>(function.me_pattern()));
*function_proto->mutable_self_pattern() =
PatternToProto(cast<BindingPattern>(function.self_pattern()));
break;
default:
// Parser shouldn't allow me_pattern to be anything other than
// Parser shouldn't allow self_pattern to be anything other than
// AddrPattern or BindingPattern
CARBON_FATAL() << "me_pattern in method declaration can be either "
"AddrPattern or BindingPattern. Actual pattern: "
<< function.me_pattern();
CARBON_FATAL()
<< "self_pattern in method declaration can be either "
"AddrPattern or BindingPattern. Actual pattern: "
<< function.self_pattern();
break;
}
}