[JS] Add getFullyQualifiedName() (#6119)

This optionally generates a static `getFullyQualifiedName()` function to get
the fully-qualified name of a type in JavaScript and TypeScript in a similar
fashion to the C++ codegen.
This commit is contained in:
Anass Al
2020-09-17 12:19:07 -07:00
committed by GitHub
parent f96d1ef744
commit b8e87fafe4
16 changed files with 213 additions and 8 deletions

View File

@@ -66,6 +66,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructInNestedNS FLATBUFFERS_FINAL_CLASS
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return StructInNestedNSTypeTable();
}
static FLATBUFFERS_CONSTEXPR const char *GetFullyQualifiedName() {
return "NamespaceA.NamespaceB.StructInNestedNS";
}
StructInNestedNS()
: a_(0),
b_(0) {
@@ -102,6 +105,9 @@ inline bool operator!=(const StructInNestedNS &lhs, const StructInNestedNS &rhs)
struct TableInNestedNST : public flatbuffers::NativeTable {
typedef TableInNestedNS TableType;
static FLATBUFFERS_CONSTEXPR const char *GetFullyQualifiedName() {
return "NamespaceA.NamespaceB.TableInNestedNST";
}
int32_t foo;
TableInNestedNST()
: foo(0) {
@@ -124,6 +130,9 @@ struct TableInNestedNS FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
return TableInNestedNSTypeTable();
}
static FLATBUFFERS_CONSTEXPR const char *GetFullyQualifiedName() {
return "NamespaceA.NamespaceB.TableInNestedNS";
}
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_FOO = 4
};