Rewrite simple test (only grpc output)

This commit is contained in:
Mathieu Acthernoene
2016-12-20 11:31:46 +01:00
parent 304fba375b
commit 536162a58b
54 changed files with 3359 additions and 2396 deletions

View File

@@ -626,6 +626,7 @@ func (g *Generator) CommandLineParameters(parameter string) {
}
}
}
if pluginList != "" {
// Amend the set of plugins.
enabled := make(map[string]bool)
@@ -1180,6 +1181,7 @@ func (g *Generator) generate(file *FileDescriptor) {
g.P("const _ = ", g.Pkg["proto"], ".ProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package")
g.P()
}
for _, td := range g.file.imp {
g.generateImported(td)
}
@@ -2076,6 +2078,11 @@ func (g *Generator) generateMessage(message *Descriptor) {
star = "*"
}
// In proto3, only generate getters for message fields and oneof fields.
if message.proto3() && *field.Type != descriptor.FieldDescriptorProto_TYPE_MESSAGE && !oneof {
continue
}
// Only export getter symbols for basic types,
// and for messages and enums in the same package.
// Groups are not exported.
@@ -2134,11 +2141,7 @@ func (g *Generator) generateMessage(message *Descriptor) {
continue
}
if !oneof {
if message.proto3() {
g.P("if m != nil {")
} else {
g.P("if m != nil && m." + fname + " != nil {")
}
g.P("if m != nil && m." + fname + " != nil {")
g.In()
g.P("return " + star + "m." + fname)
g.Out()
@@ -2556,7 +2559,6 @@ func (g *Generator) generateExtension(ext *ExtensionDescriptor) {
g.P("Field: ", field.Number, ",")
g.P(`Name: "`, extName, `",`)
g.P("Tag: ", tag, ",")
g.P(`Filename: "`, g.file.GetName(), `",`)
g.Out()
g.P("}")