Skip to content

Commit

Permalink
Fix code generation
Browse files Browse the repository at this point in the history
  • Loading branch information
brunexgeek committed Mar 6, 2020
1 parent b8e4bcb commit 6786f20
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions library/cpp/code.txt
Original file line number Diff line number Diff line change
Expand Up @@ -548,8 +548,6 @@ static std::string reveal( const char *value, size_t length )
return result;
}
}
#endif

------

--- CODE_BLOCK_4
Expand Down
5 changes: 2 additions & 3 deletions library/cpp/cppgen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -750,11 +750,10 @@ static void generateModel( GeneratorContext &ctx )
ctx.printer(CODE_REPEATED_TRAIT, "std::vector");
ctx.printer(CODE_REPEATED_TRAIT, "std::list");
ctx.printer.output() << CODE_BLOCK_3;
ctx.printer(CODE_REPEATED_FIELD);
ctx.printer.output() << CODE_REPEATED_FIELD;
if (ctx.cpp_enable_parent)
ctx.printer(CODE_PARENT_CLASS);
if (ctx.obfuscate_strings)
ctx.printer(CODE_STRING_REVEAL);
ctx.printer.output() << (CODE_STRING_REVEAL);
ctx.printer.output() << CODE_BLOCK_4;
ctx.printer("#endif // PROTOGEN_BASE_$1$\n", version);

Expand Down
2 changes: 1 addition & 1 deletion library/proto3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ static void parseField( ProtoContext &ctx, Message &message )
throw exception("Expected ';'", TOKEN_POSITION(ctx.tokens.current));

// check for repeated field indices
for (auto it = message.fields.begin(); it++ != message.fields.end();)
for (auto it = message.fields.begin(); it != message.fields.end(); it++)
if (it->index == field.index)
throw exception("Field '" + it->name + "' has the same index as '" + field.name + "'", CURRENT_TOKEN_POSITION);

Expand Down

0 comments on commit 6786f20

Please sign in to comment.