Protobuf: removed named arguments in constructors and redundant init section from generated code
This commit is contained in:
+1
-5
@@ -32,10 +32,6 @@ void ClassGenerator::generateCode(io::Printer *printer, bool isBuilder) const {
|
|||||||
// Generate field for errors code
|
// Generate field for errors code
|
||||||
printer->Print("var errorCode: Int = 0\n\n");
|
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
|
// enum declarations and nested classes declarations only for fair classes
|
||||||
if (!isBuilder) {
|
if (!isBuilder) {
|
||||||
if (enumsDeclaraions.size() > 0) {
|
if (enumsDeclaraions.size() > 0) {
|
||||||
@@ -422,7 +418,7 @@ string ClassGenerator::getBuilderInitValue() const {
|
|||||||
// build list of arguments like 'field1: Type1, field2: Type2, ... '
|
// build list of arguments like 'field1: Type1, field2: Type2, ... '
|
||||||
string argumentList = "";
|
string argumentList = "";
|
||||||
for (int i = 0; i < properties.size(); ++i) {
|
for (int i = 0; i < properties.size(); ++i) {
|
||||||
argumentList += properties[i]->simpleName + " = " + properties[i]->getInitValue();
|
argumentList += properties[i]->getInitValue();
|
||||||
if (i + 1 != properties.size()) {
|
if (i + 1 != properties.size()) {
|
||||||
argumentList += ", ";
|
argumentList += ", ";
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ string FieldGenerator::getInitValue() const {
|
|||||||
// build list of arguments like 'field1: Type1, field2: Type2, ... '
|
// build list of arguments like 'field1: Type1, field2: Type2, ... '
|
||||||
string argumentList = "";
|
string argumentList = "";
|
||||||
for (int i = 0; i < cg->properties.size(); ++i) {
|
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()) {
|
if (i + 1 != cg->properties.size()) {
|
||||||
argumentList += ", ";
|
argumentList += ", ";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user