Changed argument names in Objective-C generated code

pull/2217/head
murgatroid99 10 years ago
parent e25ec14601
commit 25a2661d6d
  1. 23
      src/compiler/objective_c_generator.cc
  2. 8
      src/objective-c/tests/InteropTests.m

@ -68,18 +68,19 @@ void PrintMethodSignature(Printer *printer,
printer->Print(vars, "- ($return_type$)$method_name$With"); printer->Print(vars, "- ($return_type$)$method_name$With");
if (method->client_streaming()) { if (method->client_streaming()) {
printer->Print("RequestsWriter:(id<GRXWriter>)request"); printer->Print("RequestsWriter:(id<GRXWriter>)requestWriter");
} else { } else {
printer->Print(vars, "Request:($request_class$ *)request"); printer->Print(vars, "Request:($request_class$ *)request");
} }
// TODO(jcanizales): Put this on a new line and align colons. // TODO(jcanizales): Put this on a new line and align colons.
// TODO(jcanizales): eventHandler for server streaming?
printer->Print(" handler:(void(^)(");
if (method->server_streaming()) { if (method->server_streaming()) {
printer->Print("BOOL done, "); printer->Print(vars, " eventHandler:(void(^)(BOOL done, "
"$response_class$ *response, NSError *error))eventHandler");
} else {
printer->Print(vars, " handler:(void(^)($response_class$ *response, "
"NSError *error))handler");
} }
printer->Print(vars, "$response_class$ *response, NSError *error))handler");
} }
void PrintSimpleSignature(Printer *printer, void PrintSimpleSignature(Printer *printer,
@ -125,11 +126,15 @@ void PrintSimpleImplementation(Printer *printer,
printer->Print("{\n"); printer->Print("{\n");
printer->Print(vars, " [[self RPCTo$method_name$With"); printer->Print(vars, " [[self RPCTo$method_name$With");
if (method->client_streaming()) { if (method->client_streaming()) {
printer->Print("RequestsWriter:request"); printer->Print("RequestsWriter:requestWriter");
} else { } else {
printer->Print("Request:request"); printer->Print("Request:request");
} }
printer->Print(" handler:handler] start];\n"); if (method->server_streaming()) {
printer->Print(" eventHandler:eventHandler] start];\n");
} else {
printer->Print(" handler:handler] start];\n");
}
printer->Print("}\n"); printer->Print("}\n");
} }
@ -141,7 +146,7 @@ void PrintAdvancedImplementation(Printer *printer,
printer->Print(" requestsWriter:"); printer->Print(" requestsWriter:");
if (method->client_streaming()) { if (method->client_streaming()) {
printer->Print("request\n"); printer->Print("requestWriter\n");
} else { } else {
printer->Print("[GRXWriter writerWithValue:request]\n"); printer->Print("[GRXWriter writerWithValue:request]\n");
} }
@ -150,7 +155,7 @@ void PrintAdvancedImplementation(Printer *printer,
printer->Print(" responsesWriteable:[GRXWriteable "); printer->Print(" responsesWriteable:[GRXWriteable ");
if (method->server_streaming()) { if (method->server_streaming()) {
printer->Print("writeableWithStreamHandler:handler]];\n"); printer->Print("writeableWithStreamHandler:eventHandler]];\n");
} else { } else {
printer->Print("writeableWithSingleValueHandler:handler]];\n"); printer->Print("writeableWithSingleValueHandler:handler]];\n");
} }

@ -174,7 +174,7 @@
__block int index = 0; __block int index = 0;
[_service streamingOutputCallWithRequest:request [_service streamingOutputCallWithRequest:request
handler:^(BOOL done, eventHandler:^(BOOL done,
RMTStreamingOutputCallResponse *response, RMTStreamingOutputCallResponse *response,
NSError *error){ NSError *error){
XCTAssertNil(error, @"Finished with unexpected error: %@", error); XCTAssertNil(error, @"Finished with unexpected error: %@", error);
@ -211,7 +211,7 @@
[requestsBuffer writeValue:request]; [requestsBuffer writeValue:request];
[_service fullDuplexCallWithRequestsWriter:requestsBuffer [_service fullDuplexCallWithRequestsWriter:requestsBuffer
handler:^(BOOL done, eventHandler:^(BOOL done,
RMTStreamingOutputCallResponse *response, RMTStreamingOutputCallResponse *response,
NSError *error) { NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error); XCTAssertNil(error, @"Finished with unexpected error: %@", error);
@ -242,7 +242,7 @@
- (void)testEmptyStreamRPC { - (void)testEmptyStreamRPC {
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyStream"]; __weak XCTestExpectation *expectation = [self expectationWithDescription:@"EmptyStream"];
[_service fullDuplexCallWithRequestsWriter:[GRXWriter emptyWriter] [_service fullDuplexCallWithRequestsWriter:[GRXWriter emptyWriter]
handler:^(BOOL done, eventHandler:^(BOOL done,
RMTStreamingOutputCallResponse *response, RMTStreamingOutputCallResponse *response,
NSError *error) { NSError *error) {
XCTAssertNil(error, @"Finished with unexpected error: %@", error); XCTAssertNil(error, @"Finished with unexpected error: %@", error);
@ -283,7 +283,7 @@
[requestsBuffer writeValue:request]; [requestsBuffer writeValue:request];
__block ProtoRPC *call = [_service RPCToFullDuplexCallWithRequestsWriter:requestsBuffer __block ProtoRPC *call = [_service RPCToFullDuplexCallWithRequestsWriter:requestsBuffer
handler:^(BOOL done, eventHandler:^(BOOL done,
RMTStreamingOutputCallResponse *response, RMTStreamingOutputCallResponse *response,
NSError *error) { NSError *error) {
if (receivedResponse) { if (receivedResponse) {

Loading…
Cancel
Save