From 333dd3e1ad9acdccb10a7536590317bf58102ad9 Mon Sep 17 00:00:00 2001 From: "David G. Quintas" Date: Mon, 27 Nov 2017 12:27:49 -0800 Subject: [PATCH] Revert "Do not interpolate variables in leading comments." --- src/compiler/cpp_generator.cc | 2 +- src/compiler/csharp_generator.cc | 2 +- src/compiler/node_generator.cc | 2 +- src/compiler/objective_c_generator.cc | 2 +- src/compiler/php_generator.cc | 2 +- src/compiler/protobuf_plugin.h | 1 - src/compiler/python_generator.cc | 2 +- src/compiler/ruby_generator.cc | 2 +- src/compiler/schema_interface.h | 1 - 9 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc index dec8cd0f25f..3adf0fa451f 100644 --- a/src/compiler/cpp_generator.cc +++ b/src/compiler/cpp_generator.cc @@ -104,7 +104,7 @@ grpc::string GetHeaderPrologue(grpc_generator::File* file, grpc::string leading_comments = file->GetLeadingComments("//"); if (!leading_comments.empty()) { printer->Print(vars, "// Original file comments:\n"); - printer->PrintRaw(leading_comments.c_str()); + printer->Print(leading_comments.c_str()); } printer->Print(vars, "#ifndef GRPC_$filename_identifier$__INCLUDED\n"); printer->Print(vars, "#define GRPC_$filename_identifier$__INCLUDED\n"); diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index 40fe0b054a5..e0957bf9bb2 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -666,7 +666,7 @@ grpc::string GetServices(const FileDescriptor* file, bool generate_client, grpc::string leading_comments = GetCsharpComments(file, true); if (!leading_comments.empty()) { out.Print("// Original file comments:\n"); - out.PrintRaw(leading_comments.c_str()); + out.Print(leading_comments.c_str()); } out.Print("#pragma warning disable 1591\n"); diff --git a/src/compiler/node_generator.cc b/src/compiler/node_generator.cc index 661587cbd63..ed835b44451 100644 --- a/src/compiler/node_generator.cc +++ b/src/compiler/node_generator.cc @@ -250,7 +250,7 @@ grpc::string GenerateFile(const FileDescriptor* file) { grpc::string leading_comments = GetNodeComments(file, true); if (!leading_comments.empty()) { out.Print("// Original file comments:\n"); - out.PrintRaw(leading_comments.c_str()); + out.Print(leading_comments.c_str()); } out.Print("'use strict';\n"); diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 8fe30e97e94..349f1dc2818 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -65,7 +65,7 @@ static void PrintAllComments(const DescriptorType* desc, Printer* printer) { printer->Print(" * "); size_t start_pos = it->find_first_not_of(' '); if (start_pos != grpc::string::npos) { - printer->PrintRaw(it->c_str() + start_pos); + printer->Print(it->c_str() + start_pos); } printer->Print("\n"); } diff --git a/src/compiler/php_generator.cc b/src/compiler/php_generator.cc index d9705e80778..1ff9520d7f5 100644 --- a/src/compiler/php_generator.cc +++ b/src/compiler/php_generator.cc @@ -164,7 +164,7 @@ grpc::string GenerateFile(const FileDescriptor* file, grpc::string leading_comments = GetPHPComments(file, "//"); if (!leading_comments.empty()) { out.Print("// Original file comments:\n"); - out.PrintRaw(leading_comments.c_str()); + out.Print(leading_comments.c_str()); } map vars; diff --git a/src/compiler/protobuf_plugin.h b/src/compiler/protobuf_plugin.h index b971af13109..1551908156a 100644 --- a/src/compiler/protobuf_plugin.h +++ b/src/compiler/protobuf_plugin.h @@ -141,7 +141,6 @@ class ProtoBufPrinter : public grpc_generator::Printer { } void Print(const char* string) { printer_.Print(string); } - void PrintRaw(const char* string) { printer_.PrintRaw(string); } void Indent() { printer_.Indent(); } void Outdent() { printer_.Outdent(); } diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc index 8a0b8894549..c1ae7d31adf 100644 --- a/src/compiler/python_generator.cc +++ b/src/compiler/python_generator.cc @@ -101,7 +101,7 @@ void PrivateGenerator::PrintAllComments(StringVector comments, ++it) { size_t start_pos = it->find_first_not_of(' '); if (start_pos != grpc::string::npos) { - out->PrintRaw(it->c_str() + start_pos); + out->Print(it->c_str() + start_pos); } out->Print("\n"); } diff --git a/src/compiler/ruby_generator.cc b/src/compiler/ruby_generator.cc index e81dea603ba..ed7e074b470 100644 --- a/src/compiler/ruby_generator.cc +++ b/src/compiler/ruby_generator.cc @@ -174,7 +174,7 @@ grpc::string GetServices(const FileDescriptor* file) { grpc::string leading_comments = GetRubyComments(file, true); if (!leading_comments.empty()) { out.Print("# Original file comments:\n"); - out.PrintRaw(leading_comments.c_str()); + out.Print(leading_comments.c_str()); } out.Print("\n"); diff --git a/src/compiler/schema_interface.h b/src/compiler/schema_interface.h index c000478e681..b2021f29267 100644 --- a/src/compiler/schema_interface.h +++ b/src/compiler/schema_interface.h @@ -86,7 +86,6 @@ struct Printer { virtual void Print(const std::map& vars, const char* template_string) = 0; virtual void Print(const char* string) = 0; - virtual void PrintRaw(const char* string) = 0; virtual void Indent() = 0; virtual void Outdent() = 0; };