Эх сурвалжийг харах

Register that the C# compiler supports proto3 presence.

(It doesn't yet, but will in the next commits...)
Jon Skeet 5 жил өмнө
parent
commit
4c9613f226

+ 7 - 0
src/google/protobuf/compiler/csharp/csharp_generator.cc

@@ -48,6 +48,13 @@ namespace protobuf {
 namespace compiler {
 namespace compiler {
 namespace csharp {
 namespace csharp {
 
 
+Generator::Generator() {}
+Generator::~Generator() {}
+
+uint64 Generator::GetSupportedFeatures() const {
+  return CodeGenerator::Feature::FEATURE_PROTO3_OPTIONAL;
+}
+
 void GenerateFile(const FileDescriptor* file, io::Printer* printer,
 void GenerateFile(const FileDescriptor* file, io::Printer* printer,
                   const Options* options) {
                   const Options* options) {
   ReflectionClassGenerator reflectionClassGenerator(file, options);
   ReflectionClassGenerator reflectionClassGenerator(file, options);

+ 8 - 5
src/google/protobuf/compiler/csharp/csharp_generator.h

@@ -50,11 +50,14 @@ namespace csharp {
 // CodeGenerator with the CommandLineInterface in your main() function.
 // CodeGenerator with the CommandLineInterface in your main() function.
 class PROTOC_EXPORT Generator : public CodeGenerator {
 class PROTOC_EXPORT Generator : public CodeGenerator {
  public:
  public:
-  virtual bool Generate(
-      const FileDescriptor* file,
-      const string& parameter,
-      GeneratorContext* generator_context,
-      string* error) const;
+  Generator();
+  ~Generator();
+  bool Generate(
+    const FileDescriptor* file,
+    const string& parameter,
+    GeneratorContext* generator_context,
+    string* error) const override;
+  uint64 GetSupportedFeatures() const override;
 };
 };
 
 
 }  // namespace csharp
 }  // namespace csharp