forked from BigfootDev/flatbuffers
Using proper symbol name for reexport (#6021)
Co-authored-by: Kamil Rojewski <kamil.rojewski@gmail.com>
This commit is contained in:
@@ -134,12 +134,14 @@ class JsTsGenerator : public BaseGenerator {
|
||||
return;
|
||||
}
|
||||
|
||||
std::unordered_set<std::string> imported;
|
||||
|
||||
std::string &code = *code_ptr;
|
||||
for (auto it = reexports.begin(); it != reexports.end(); ++it) {
|
||||
const auto &file = *it;
|
||||
const auto basename =
|
||||
flatbuffers::StripPath(flatbuffers::StripExtension(file.first));
|
||||
if (basename != file_name_) {
|
||||
if (basename != file_name_ && imported.find(file.second.symbol) == imported.end()) {
|
||||
if (imported_files.find(file.first) == imported_files.end()) {
|
||||
code += GenPrefixedImport(file.first, basename);
|
||||
imported_files.emplace(file.first);
|
||||
@@ -155,6 +157,8 @@ class JsTsGenerator : public BaseGenerator {
|
||||
}
|
||||
code += file.second.symbol + ";\n";
|
||||
if (!file.second.target_namespace.empty()) { code += "}\n"; }
|
||||
|
||||
imported.emplace(file.second.symbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -366,7 +370,7 @@ class JsTsGenerator : public BaseGenerator {
|
||||
code += (it + 1) != enum_def.Vals().end() ? ",\n" : "\n";
|
||||
|
||||
if (ev.union_type.struct_def) {
|
||||
ReexportDescription desc = { ev.name,
|
||||
ReexportDescription desc = { ev.union_type.struct_def->name,
|
||||
GetNameSpace(*ev.union_type.struct_def),
|
||||
GetNameSpace(enum_def) };
|
||||
reexports.insert(
|
||||
|
||||
Reference in New Issue
Block a user