mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 13:53:38 +00:00
- fix CSharp comments generation - fix Python comments generation - fix Lua comments generation - fix PHP comments generation - fix Dart comments generation - add brief description of Color enum - add multi-line comments to the Monster:Color
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
bc7ede8fb3
commit
95004218f7
@@ -29,6 +29,7 @@ namespace flatbuffers {
|
||||
namespace lua {
|
||||
|
||||
// Hardcode spaces per indentation.
|
||||
const CommentConfig def_comment = { nullptr, "--", nullptr };
|
||||
const char * Indent = " ";
|
||||
const char * Comment = "-- ";
|
||||
const char * End = "end\n";
|
||||
@@ -472,7 +473,7 @@ namespace lua {
|
||||
// Generate a struct field, conditioned on its child type(s).
|
||||
void GenStructAccessor(const StructDef &struct_def,
|
||||
const FieldDef &field, std::string *code_ptr) {
|
||||
GenComment(field.doc_comment, code_ptr, nullptr, Comment);
|
||||
GenComment(field.doc_comment, code_ptr, &def_comment);
|
||||
if (IsScalar(field.value.type.base_type)) {
|
||||
if (struct_def.fixed) {
|
||||
GetScalarFieldOfStruct(struct_def, field, code_ptr);
|
||||
@@ -535,7 +536,7 @@ namespace lua {
|
||||
void GenStruct(const StructDef &struct_def, std::string *code_ptr) {
|
||||
if (struct_def.generated) return;
|
||||
|
||||
GenComment(struct_def.doc_comment, code_ptr, nullptr, Comment);
|
||||
GenComment(struct_def.doc_comment, code_ptr, &def_comment);
|
||||
BeginClass(struct_def, code_ptr);
|
||||
|
||||
GenerateNewObjectPrototype(struct_def, code_ptr);
|
||||
@@ -571,12 +572,12 @@ namespace lua {
|
||||
void GenEnum(const EnumDef &enum_def, std::string *code_ptr) {
|
||||
if (enum_def.generated) return;
|
||||
|
||||
GenComment(enum_def.doc_comment, code_ptr, nullptr, Comment);
|
||||
GenComment(enum_def.doc_comment, code_ptr, &def_comment);
|
||||
BeginEnum(NormalizedName(enum_def), code_ptr);
|
||||
for (auto it = enum_def.Vals().begin(); it != enum_def.Vals().end();
|
||||
++it) {
|
||||
auto &ev = **it;
|
||||
GenComment(ev.doc_comment, code_ptr, nullptr, Comment);
|
||||
GenComment(ev.doc_comment, code_ptr, &def_comment, Indent);
|
||||
EnumMember(enum_def, ev, code_ptr);
|
||||
}
|
||||
EndEnum(code_ptr);
|
||||
|
||||
Reference in New Issue
Block a user