remove legacy generate class file

pull/9621/head
Brent Shaffer 3 years ago
parent 5dab09408c
commit 5f477fc440
  1. 39
      src/google/protobuf/compiler/php/php_generator.cc

@ -1265,43 +1265,6 @@ void GenerateMetadataFile(const FileDescriptor* file, const Options& options,
printer.Print("}\n\n");
}
template <typename DescriptorType>
void LegacyGenerateClassFile(const FileDescriptor* file,
const DescriptorType* desc, const Options& options,
GeneratorContext* generator_context) {
std::string filename = LegacyGeneratedClassFileName(desc, options);
std::unique_ptr<io::ZeroCopyOutputStream> output(
generator_context->Open(filename));
io::Printer printer(output.get(), '^');
GenerateHead(file, &printer);
std::string php_namespace = RootPhpNamespace(desc, options);
if (!php_namespace.empty()) {
printer.Print(
"namespace ^name^;\n\n",
"name", php_namespace);
}
std::string newname = FullClassName(desc, options);
printer.Print("if (false) {\n");
Indent(&printer);
printer.Print("/**\n");
printer.Print(" * This class is deprecated. Use ^new^ instead.\n",
"new", newname);
printer.Print(" * @deprecated\n");
printer.Print(" */\n");
printer.Print("class ^old^ {}\n",
"old", LegacyGeneratedClassName(desc));
Outdent(&printer);
printer.Print("}\n");
printer.Print("class_exists(^new^::class);\n",
"new", GeneratedClassNameImpl(desc));
printer.Print("@trigger_error('^old^ is deprecated and will be removed in "
"the next major release. Use ^fullname^ instead', E_USER_DEPRECATED);\n\n",
"old", LegacyFullClassName(desc, options),
"fullname", newname);
}
void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
const Options& options,
GeneratorContext* generator_context) {
@ -1403,7 +1366,6 @@ void GenerateEnumFile(const FileDescriptor* file, const EnumDescriptor* en,
"class_alias(^new^::class, \\^old^::class);\n\n",
"new", fullname,
"old", LegacyFullClassName(en, options));
LegacyGenerateClassFile(file, en, options, generator_context);
}
}
@ -1518,7 +1480,6 @@ void GenerateMessageFile(const FileDescriptor* file, const Descriptor* message,
"class_alias(^new^::class, \\^old^::class);\n\n",
"new", fullname,
"old", LegacyFullClassName(message, options));
LegacyGenerateClassFile(file, message, options, generator_context);
}
// Nested messages and enums.

Loading…
Cancel
Save