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
cc57e5c1
Commit
cc57e5c1
authored
Mar 30, 2016
by
David Lamparter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propagate DocComments into binary schema
parent
981814eb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
node-translator.c++
c++/src/capnp/compiler/node-translator.c++
+12
-0
schema.capnp
c++/src/capnp/schema.capnp
+6
-0
No files found.
c++/src/capnp/compiler/node-translator.c++
View file @
cc57e5c1
...
...
@@ -1428,6 +1428,9 @@ void NodeTranslator::compileNode(Declaration::Reader decl, schema::Node::Builder
}
builder
.
adoptAnnotations
(
compileAnnotationApplications
(
decl
.
getAnnotations
(),
targetsFlagName
));
if
(
decl
.
hasDocComment
())
builder
.
setDocComment
(
decl
.
getDocComment
());
}
static
kj
::
StringPtr
getExpressionTargetName
(
Expression
::
Reader
exp
)
{
...
...
@@ -1740,6 +1743,8 @@ private:
// Information about the field declaration. We don't use Declaration::Reader because it might
// have come from a Declaration::Param instead.
kj
::
Maybe
<::
capnp
::
Text
::
Reader
>
docComment
=
nullptr
;
kj
::
Maybe
<
schema
::
Field
::
Builder
>
schema
;
// Schema for the field. Initialized when getSchema() is first called.
...
...
@@ -1776,6 +1781,8 @@ private:
hasDefaultValue
=
true
;
fieldDefaultValue
=
fieldDecl
.
getDefaultValue
().
getValue
();
}
if
(
decl
.
hasDocComment
())
docComment
=
decl
.
getDocComment
();
}
inline
MemberInfo
(
MemberInfo
&
parent
,
uint
codeOrder
,
const
Declaration
::
Param
::
Reader
&
decl
,
...
...
@@ -1802,6 +1809,8 @@ private:
startByte
(
decl
.
getStartByte
()),
endByte
(
decl
.
getEndByte
()),
node
(
node
),
unionScope
(
nullptr
)
{
KJ_REQUIRE
(
decl
.
which
()
!=
Declaration
::
FIELD
);
if
(
decl
.
hasDocComment
())
docComment
=
decl
.
getDocComment
();
}
schema
::
Field
::
Builder
getSchema
()
{
...
...
@@ -1815,6 +1824,9 @@ private:
}
builder
.
setName
(
name
);
builder
.
setCodeOrder
(
codeOrder
);
KJ_IF_MAYBE
(
docCommentReal
,
docComment
)
{
builder
.
setDocComment
(
*
docCommentReal
);
}
schema
=
builder
;
return
builder
;
}
...
...
c++/src/capnp/schema.capnp
View file @
cc57e5c1
...
...
@@ -77,6 +77,9 @@ struct Node {
annotations @5 :List(Annotation);
# Annotations applied to this node.
docComment @34 :Text;
# This line, but on a node not on a Field...
union {
# Info specific to each kind of node.
...
...
@@ -186,6 +189,9 @@ struct Field {
annotations @2 :List(Annotation);
docComment @11 :Text;
# This line.
const noDiscriminant :UInt16 = 0xffff;
discriminantValue @3 :UInt16 = Field.noDiscriminant;
...
...
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