Add the file a symbol is declared in to Reflection (#6613)

* Add the file a symbol is declared in to Reflection

If we move a code-generator to depend on Reflection,
it may need to know which file something was declared in
to properly name generated files.

* Doc comments in reflection, and more precise tests

* Add --project-root flag to flatc, normalize declaraion_file to this root

* fix --project-root stuff

* posixpath

* fix scripts

* format

* rename --project-root to --bfbs-filenames

Also, make it optional, rather than defaulting to `./`, if its not
specified, then don't serialize the filenames.

* bfbs generation

* fix some tests

* uncomment a thing

* add  to project root directory conditionally

* fix

* git clang format

* Added help description and removed != nullptr

* "

* Remove accidental change to docs

* Remove accidental change to docs

* Pool strings

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2021-06-17 11:50:04 -04:00
committed by GitHub
parent 2cf7bb7966
commit c58ae94225
20 changed files with 868 additions and 674 deletions

View File

@@ -60,6 +60,8 @@ table Enum {
underlying_type:Type (required);
attributes:[KeyValue];
documentation:[string];
/// File that this Enum is declared in.
declaration_file: string;
}
table Field {
@@ -85,6 +87,8 @@ table Object { // Used for both tables and structs.
bytesize:int; // For structs.
attributes:[KeyValue];
documentation:[string];
/// File that this Object is declared in.
declaration_file: string;
}
table RPCCall {
@@ -100,9 +104,11 @@ table Service {
calls:[RPCCall];
attributes:[KeyValue];
documentation:[string];
/// File that this Service is declared in.
declaration_file: string;
}
// New schema language features that are not supported by old code generators.
/// New schema language features that are not supported by old code generators.
enum AdvancedFeatures : ulong (bit_flags) {
AdvancedArrayFeatures,
AdvancedUnionFeatures,
@@ -118,6 +124,9 @@ table Schema {
root_table:Object;
services:[Service]; // Sorted.
advanced_features:AdvancedFeatures;
/// All the files used in this compilation. Files are relative to where
/// flatc was invoked.
fbs_files:[string];
}
root_type Schema;