Added nullability to service declaration in objc

pull/6205/head
Benjamin Herzog 9 years ago
parent c2b6a0bcf9
commit 208795c0fe
  1. 6
      src/compiler/objective_c_generator.cc
  2. 7
      src/compiler/objective_c_plugin.cc

@ -75,11 +75,11 @@ void PrintMethodSignature(Printer *printer, const MethodDescriptor *method,
if (method->server_streaming()) {
printer->Print(vars,
" eventHandler:(void(^)(BOOL done, "
"$response_class$ *response, NSError *error))eventHandler");
"$response_class$ *_Nullable response, NSError *_Nullable error))eventHandler");
} else {
printer->Print(vars,
" handler:(void(^)($response_class$ *response, "
"NSError *error))handler");
" handler:(void(^)($response_class$ *_Nullable response, "
"NSError *_Nullable error))handler");
}
}

@ -64,7 +64,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
".pbobjc.h\"\n\n"
"#import <ProtoRPC/ProtoService.h>\n"
"#import <RxLibrary/GRXWriteable.h>\n"
"#import <RxLibrary/GRXWriter.h>\n";
"#import <RxLibrary/GRXWriter.h>\n\n"
"NS_ASSUME_NONNULL_BEGIN\n\n";
// TODO(jcanizales): Instead forward-declare the input and output types
// and import the files in the .pbrpc.m
@ -81,8 +82,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
declarations += grpc_objective_c_generator::GetHeader(service);
}
::grpc::string nonNullEnd = "\nNS_ASSUME_NONNULL_END\n";
Write(context, file_name + ".pbrpc.h",
imports + '\n' + proto_imports + '\n' + declarations);
imports + '\n' + proto_imports + '\n' + declarations + nonNullEnd);
}
{

Loading…
Cancel
Save