-
Notifications
You must be signed in to change notification settings - Fork 433
Labels
cpp: generatorIssues related to the C++ micro-generatorIssues related to the C++ micro-generatortype: cleanupAn internal cleanup or hygiene concern.An internal cleanup or hygiene concern.
Description
The generator has a lot of code that looks (essentially) like:
if (IsResponseTypeEmpty()) {
Print(R"""(
Status
FooClient::Foo(...) { ...}
)""");
} else {
Print(R"""(
StatusOr<$response_type$>
FooClient::Foo(...) { ...}
)""");
}
Where the body of the function is identical. Only the return type is different.
We could move the if statements into something like descriptor_utils: and define some new variable: $return_type$ = IsResponseTypeEmpty() ? "Status" : "StatusOr<" + response_type + ">". Basically, have one branch in descriptor_utils instead of having N branches across all the service code generators.
Metadata
Metadata
Assignees
Labels
cpp: generatorIssues related to the C++ micro-generatorIssues related to the C++ micro-generatortype: cleanupAn internal cleanup or hygiene concern.An internal cleanup or hygiene concern.