Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
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
capnproto
Commits
880bbbbe
Commit
880bbbbe
authored
Apr 25, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't report missing file ID error after parse error.
Fixes #251
parent
559a592b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
parser.c++
c++/src/capnp/compiler/parser.c++
+9
-3
No files found.
c++/src/capnp/compiler/parser.c++
View file @
880bbbbe
...
@@ -172,11 +172,17 @@ void parseFile(List<Statement>::Reader statements, ParsedFile::Builder result,
...
@@ -172,11 +172,17 @@ void parseFile(List<Statement>::Reader statements, ParsedFile::Builder result,
}
}
if
(
fileDecl
.
getId
().
which
()
!=
Declaration
::
Id
::
UID
)
{
if
(
fileDecl
.
getId
().
which
()
!=
Declaration
::
Id
::
UID
)
{
// We didn't see an ID. Generate one randomly for now.
uint64_t
id
=
generateRandomId
();
uint64_t
id
=
generateRandomId
();
fileDecl
.
getId
().
initUid
().
setValue
(
id
);
fileDecl
.
getId
().
initUid
().
setValue
(
id
);
errorReporter
.
addError
(
0
,
0
,
kj
::
str
(
"File does not declare an ID. I've generated one for you. Add this line to your "
// Don't report missing ID if there was a parse error, because quite often the parse error
"file: @0x"
,
kj
::
hex
(
id
),
";"
));
// prevents us from parsing the ID even though it is actually there.
if
(
!
errorReporter
.
hadErrors
())
{
errorReporter
.
addError
(
0
,
0
,
kj
::
str
(
"File does not declare an ID. I've generated one for you. Add this line to "
"your file: @0x"
,
kj
::
hex
(
id
),
";"
));
}
}
}
auto
declsBuilder
=
fileDecl
.
initNestedDecls
(
decls
.
size
());
auto
declsBuilder
=
fileDecl
.
initNestedDecls
(
decls
.
size
());
...
...
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