From cea504b095701fdd3fe7f0a197a188ed597fbba2 Mon Sep 17 00:00:00 2001 From: dsavvinov Date: Thu, 11 Aug 2016 13:47:07 +0300 Subject: [PATCH] Protobuf: removed named arguments in constructors and redundant init section from generated code --- .../protobuf/compiler/kotlin/src/kotlin_class_generator.cc | 6 +----- .../protobuf/compiler/kotlin/src/kotlin_field_generator.cc | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/proto/compiler/google/src/google/protobuf/compiler/kotlin/src/kotlin_class_generator.cc b/proto/compiler/google/src/google/protobuf/compiler/kotlin/src/kotlin_class_generator.cc index 8d696c104b2..1c7c4f3c96f 100644 --- a/proto/compiler/google/src/google/protobuf/compiler/kotlin/src/kotlin_class_generator.cc +++ b/proto/compiler/google/src/google/protobuf/compiler/kotlin/src/kotlin_class_generator.cc @@ -32,10 +32,6 @@ void ClassGenerator::generateCode(io::Printer *printer, bool isBuilder) const { // Generate field for errors code printer->Print("var errorCode: Int = 0\n\n"); - // Generate construction routines - generateInitSection(printer); - printer->Print("\n"); - // enum declarations and nested classes declarations only for fair classes if (!isBuilder) { if (enumsDeclaraions.size() > 0) { @@ -422,7 +418,7 @@ string ClassGenerator::getBuilderInitValue() const { // build list of arguments like 'field1: Type1, field2: Type2, ... ' string argumentList = ""; for (int i = 0; i < properties.size(); ++i) { - argumentList += properties[i]->simpleName + " = " + properties[i]->getInitValue(); + argumentList += properties[i]->getInitValue(); if (i + 1 != properties.size()) { argumentList += ", "; } diff --git a/proto/compiler/google/src/google/protobuf/compiler/kotlin/src/kotlin_field_generator.cc b/proto/compiler/google/src/google/protobuf/compiler/kotlin/src/kotlin_field_generator.cc index 37ce6198b38..c1e3b4fcbe7 100644 --- a/proto/compiler/google/src/google/protobuf/compiler/kotlin/src/kotlin_field_generator.cc +++ b/proto/compiler/google/src/google/protobuf/compiler/kotlin/src/kotlin_field_generator.cc @@ -25,7 +25,7 @@ string FieldGenerator::getInitValue() const { // build list of arguments like 'field1: Type1, field2: Type2, ... ' string argumentList = ""; for (int i = 0; i < cg->properties.size(); ++i) { - argumentList += cg->properties[i]->simpleName + " = " + cg->properties[i]->getInitValue(); + argumentList += cg->properties[i]->getInitValue(); if (i + 1 != cg->properties.size()) { argumentList += ", "; }