[Lua] Apply Namer to Lua (#7171)

* Apply Namer to Lua bfbs code gen

* refactor namer into IdlNamer to keep idl includes separate

* remove commented out code

* added bfbs_namer

* remove Enum case

* add to bazel
This commit is contained in:
Derek Bailey
2022-03-15 21:48:42 -07:00
committed by GitHub
parent b8c77d4041
commit 0bceba24db
11 changed files with 383 additions and 234 deletions

View File

@@ -20,7 +20,7 @@
#include "flatbuffers/flatbuffers.h"
#include "flatbuffers/idl.h"
#include "flatbuffers/util.h"
#include "namer.h"
#include "idl_namer.h"
namespace flatbuffers {
@@ -280,7 +280,7 @@ bool GenerateRustModuleRootFile(const Parser &parser,
// so return true.
return true;
}
Namer namer(RustDefaultConfig().WithFlagOptions(parser.opts, output_dir),
Namer namer(WithFlagOptions(RustDefaultConfig(), parser.opts, output_dir),
RustKeywords());
// We gather the symbols into a tree of namespaces (which are rust mods) and
// generate a file that gathers them all.
@@ -345,8 +345,8 @@ class RustGenerator : public BaseGenerator {
const std::string &file_name)
: BaseGenerator(parser, path, file_name, "", "::", "rs"),
cur_name_space_(nullptr),
namer_({ RustDefaultConfig().WithFlagOptions(parser.opts, path),
RustKeywords() }) {
namer_(WithFlagOptions(RustDefaultConfig(), parser.opts, path),
RustKeywords()) {
// TODO: Namer flag overrides should be in flatc or flatc_main.
code_.SetPadding(" ");
}
@@ -2959,7 +2959,7 @@ class RustGenerator : public BaseGenerator {
}
private:
Namer namer_;
IdlNamer namer_;
};
} // namespace rust