Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
flatbuffers
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
flatbuffers
Commits
e9f1f4d9
Commit
e9f1f4d9
authored
Jun 02, 2017
by
Wouter van Oortmerssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disallowing field name same as table name.
Change-Id: I4b5d822cc4eda975949d1b7cf33674c5bbf9d4b1 Tested: on Linux.
parent
dd05f324
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
idl_parser.cpp
src/idl_parser.cpp
+4
-0
test.cpp
tests/test.cpp
+1
-0
No files found.
src/idl_parser.cpp
View file @
e9f1f4d9
...
...
@@ -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
(
':'
);
...
...
tests/test.cpp
View file @
e9f1f4d9
...
...
@@ -1038,6 +1038,7 @@ void ErrorTest() {
TestError
(
"table X { Y:[[int]]; }"
,
"nested vector"
);
TestError
(
"table X { Y:1; }"
,
"illegal type"
);
TestError
(
"table X { Y:int; Y:int; }"
,
"field already"
);
TestError
(
"table X { X:int; }"
,
"same as table"
);
TestError
(
"struct X { Y:string; }"
,
"only scalar"
);
TestError
(
"struct X { Y:int (deprecated); }"
,
"deprecate"
);
TestError
(
"union Z { X } table X { Y:Z; } root_type X; { Y: {}, A:1 }"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment