diff options
author | murgatroid99 <mlumish@google.com> | 2016-07-01 15:20:51 -0700 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2016-08-12 11:44:04 -0700 |
commit | a842413ea2a4ed57ea521760d49b50fb35ff4704 (patch) | |
tree | 256762614be265d5fff7665c4482d6ce7fadd349 /src | |
parent | 04132ae14a5637b5b13f639ade26ccd2502ded92 (diff) |
Make Node code generator work properly with nested types
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/node_generator.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/compiler/node_generator.cc b/src/compiler/node_generator.cc index 1fe090d17a..2ac5e772ac 100644 --- a/src/compiler/node_generator.cc +++ b/src/compiler/node_generator.cc @@ -111,8 +111,8 @@ map<grpc::string, const Descriptor*> GetAllMessages(const FileDescriptor *file) const MethodDescriptor* method = service->method(method_num); const Descriptor* input_type = method->input_type(); const Descriptor* output_type = method->output_type(); - message_types[input_type->name()] = input_type; - message_types[output_type->name()] = output_type; + message_types[input_type->full_name()] = input_type; + message_types[output_type->full_name()] = output_type; } } return message_types; @@ -124,7 +124,7 @@ grpc::string MessageIdentifierName(const grpc::string& name) { grpc::string NodeObjectPath(const Descriptor *descriptor) { grpc::string module_alias = ModuleAlias(descriptor->file()->name()); - grpc::string name = descriptor->name(); + grpc::string name = descriptor->full_name(); grpc_generator::StripPrefix(&name, descriptor->file()->package() + "."); return module_alias + "." + name; } @@ -132,8 +132,9 @@ grpc::string NodeObjectPath(const Descriptor *descriptor) { // Prints out the message serializer and deserializer functions void PrintMessageTransformer(const Descriptor *descriptor, Printer *out) { map<grpc::string, grpc::string> template_vars; - template_vars["identifier_name"] = MessageIdentifierName(descriptor->name()); - template_vars["name"] = descriptor->name(); + grpc::string full_name = descriptor->full_name(); + template_vars["identifier_name"] = MessageIdentifierName(full_name); + template_vars["name"] = full_name; template_vars["node_name"] = NodeObjectPath(descriptor); // Print the serializer out->Print(template_vars, "function serialize_$identifier_name$(arg) {\n"); @@ -166,9 +167,9 @@ void PrintMethod(const MethodDescriptor *method, Printer *out) { vars["service_name"] = method->service()->full_name(); vars["name"] = method->name(); vars["input_type"] = NodeObjectPath(input_type); - vars["input_type_id"] = MessageIdentifierName(input_type->name()); + vars["input_type_id"] = MessageIdentifierName(input_type->full_name()); vars["output_type"] = NodeObjectPath(output_type); - vars["output_type_id"] = MessageIdentifierName(output_type->name()); + vars["output_type_id"] = MessageIdentifierName(output_type->full_name()); vars["client_stream"] = method->client_streaming() ? "true" : "false"; vars["server_stream"] = method->server_streaming() ? "true" : "false"; out->Print("{\n"); |