Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
c4326ef2
Commit
c4326ef2
authored
8 years ago
by
murgatroid99
Browse files
Options
Downloads
Patches
Plain Diff
Make Node code generator work properly with nested types
parent
20caeb18
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/compiler/node_generator.cc
+8
-7
8 additions, 7 deletions
src/compiler/node_generator.cc
with
8 additions
and
7 deletions
src/compiler/node_generator.cc
+
8
−
7
View file @
c4326ef2
...
...
@@ -111,8 +111,8 @@ map<grpc::string, const Descriptor*> GetAllMessages(const FileDescriptor *file)
const
MethodDescriptor
*
method
=
service
->
method
(
method_num
);
const
Descriptor
*
input_type
=
method
->
input_type
();
const
Descriptor
*
output_type
=
method
->
output_type
();
message_types
[
input_type
->
name
()]
=
input_type
;
message_types
[
output_type
->
name
()]
=
output_type
;
message_types
[
input_type
->
full_
name
()]
=
input_type
;
message_types
[
output_type
->
full_
name
()]
=
output_type
;
}
}
return
message_types
;
...
...
@@ -124,7 +124,7 @@ grpc::string MessageIdentifierName(const grpc::string& name) {
grpc
::
string
NodeObjectPath
(
const
Descriptor
*
descriptor
)
{
grpc
::
string
module_alias
=
ModuleAlias
(
descriptor
->
file
()
->
name
());
grpc
::
string
name
=
descriptor
->
name
();
grpc
::
string
name
=
descriptor
->
full_
name
();
grpc_generator
::
StripPrefix
(
&
name
,
descriptor
->
file
()
->
package
()
+
"."
);
return
module_alias
+
"."
+
name
;
}
...
...
@@ -132,8 +132,9 @@ grpc::string NodeObjectPath(const Descriptor *descriptor) {
// Prints out the message serializer and deserializer functions
void
PrintMessageTransformer
(
const
Descriptor
*
descriptor
,
Printer
*
out
)
{
map
<
grpc
::
string
,
grpc
::
string
>
template_vars
;
template_vars
[
"identifier_name"
]
=
MessageIdentifierName
(
descriptor
->
name
());
template_vars
[
"name"
]
=
descriptor
->
name
();
grpc
::
string
full_name
=
descriptor
->
full_name
();
template_vars
[
"identifier_name"
]
=
MessageIdentifierName
(
full_name
);
template_vars
[
"name"
]
=
full_name
;
template_vars
[
"node_name"
]
=
NodeObjectPath
(
descriptor
);
// Print the serializer
out
->
Print
(
template_vars
,
"function serialize_$identifier_name$(arg) {
\n
"
);
...
...
@@ -166,9 +167,9 @@ void PrintMethod(const MethodDescriptor *method, Printer *out) {
vars
[
"service_name"
]
=
method
->
service
()
->
full_name
();
vars
[
"name"
]
=
method
->
name
();
vars
[
"input_type"
]
=
NodeObjectPath
(
input_type
);
vars
[
"input_type_id"
]
=
MessageIdentifierName
(
input_type
->
name
());
vars
[
"input_type_id"
]
=
MessageIdentifierName
(
input_type
->
full_
name
());
vars
[
"output_type"
]
=
NodeObjectPath
(
output_type
);
vars
[
"output_type_id"
]
=
MessageIdentifierName
(
output_type
->
name
());
vars
[
"output_type_id"
]
=
MessageIdentifierName
(
output_type
->
full_
name
());
vars
[
"client_stream"
]
=
method
->
client_streaming
()
?
"true"
:
"false"
;
vars
[
"server_stream"
]
=
method
->
server_streaming
()
?
"true"
:
"false"
;
out
->
Print
(
"{
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment