mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
Disallowing field name same as table name.
Change-Id: I4b5d822cc4eda975949d1b7cf33674c5bbf9d4b1 Tested: on Linux.
This commit is contained in:
@@ -601,6 +601,10 @@ CheckedError Parser::AddField(StructDef &struct_def, const std::string &name,
|
||||
|
||||
CheckedError Parser::ParseField(StructDef &struct_def) {
|
||||
std::string name = attribute_;
|
||||
|
||||
if (name == struct_def.name)
|
||||
return Error("field name can not be the same as table/struct name");
|
||||
|
||||
std::vector<std::string> dc = doc_comment_;
|
||||
EXPECT(kTokenIdentifier);
|
||||
EXPECT(':');
|
||||
|
||||
Reference in New Issue
Block a user