Added way to test two schemas for safe evolution.

Change-Id: I1dfc867e6df5932ab61dad431eb3cb02f15d04df
Tested: on Linux.
Bug: 30202327
This commit is contained in:
Wouter van Oortmerssen
2016-07-20 17:24:50 -07:00
parent 77e9122681
commit 05b00c50ad
5 changed files with 146 additions and 33 deletions

View File

@@ -311,6 +311,14 @@ struct EnumDef : public Definition {
Type underlying_type;
};
inline bool EqualByName(const Type &a, const Type &b) {
return a.base_type == b.base_type && a.element == b.element &&
(a.struct_def == b.struct_def ||
a.struct_def->name == b.struct_def->name) &&
(a.enum_def == b.enum_def ||
a.enum_def->name == b.enum_def->name);
}
struct RPCCall {
std::string name;
SymbolTable<Value> attributes;
@@ -473,6 +481,10 @@ class Parser : public ParserState {
// See reflection/reflection.fbs
void Serialize();
// Checks that the schema represented by this parser is a safe evolution
// of the schema provided. Returns non-empty error on any problems.
std::string ConformTo(const Parser &base);
FLATBUFFERS_CHECKED_ERROR CheckBitsFit(int64_t val, size_t bits);
private: