mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 20:15:34 +00:00
fixed bfbs gen to pass extra options (#7949)
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "bfbs_namer.h"
|
||||
|
||||
// The intermediate representation schema.
|
||||
#include "flatbuffers/code_generator.h"
|
||||
#include "flatbuffers/reflection.h"
|
||||
#include "flatbuffers/reflection_generated.h"
|
||||
|
||||
@@ -78,7 +79,10 @@ class LuaBfbsGenerator : public BaseBfbsGenerator {
|
||||
flatc_version_(flatc_version),
|
||||
namer_(LuaDefaultConfig(), LuaKeywords()) {}
|
||||
|
||||
Status GenerateFromSchema(const r::Schema *schema) FLATBUFFERS_OVERRIDE {
|
||||
Status GenerateFromSchema(const r::Schema *schema,
|
||||
const CodeGenOptions &options)
|
||||
FLATBUFFERS_OVERRIDE {
|
||||
options_ = options;
|
||||
if (!GenerateEnums(schema->enums())) { return ERROR; }
|
||||
if (!GenerateObjects(schema->objects(), schema->root_table())) {
|
||||
return ERROR;
|
||||
@@ -89,7 +93,7 @@ class LuaBfbsGenerator : public BaseBfbsGenerator {
|
||||
using BaseBfbsGenerator::GenerateCode;
|
||||
|
||||
Status GenerateCode(const Parser &, const std::string &,
|
||||
const std::string &) FLATBUFFERS_OVERRIDE {
|
||||
const std::string &) override {
|
||||
return Status::NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -652,12 +656,14 @@ class LuaBfbsGenerator : public BaseBfbsGenerator {
|
||||
|
||||
// TODO(derekbailey): figure out a save file without depending on util.h
|
||||
EnsureDirExists(path);
|
||||
const std::string file_name = path + "/" + namer_.File(name);
|
||||
const std::string file_name = options_.output_path + path + "/" + namer_.File(name);
|
||||
SaveFile(file_name.c_str(), code, false);
|
||||
}
|
||||
|
||||
std::unordered_set<std::string> keywords_;
|
||||
std::map<std::string, std::string> requires_;
|
||||
CodeGenOptions options_;
|
||||
|
||||
const r::Object *current_obj_;
|
||||
const r::Enum *current_enum_;
|
||||
const std::string flatc_version_;
|
||||
|
||||
Reference in New Issue
Block a user