Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Unified Diff: tools/json_schema_compiler/idl_schema.py

Issue 12316031: Fixed problem with non-void return types in IDL (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed debugging print statement Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/json_schema_compiler/idl_schema.py
diff --git a/tools/json_schema_compiler/idl_schema.py b/tools/json_schema_compiler/idl_schema.py
index 8334e7ed8db9b62ca147dd08da568e449f3af3d0..f8f923610a2304cff58b18e2fa14f2eca410dc8d 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -88,7 +88,8 @@ def ProcessComment(comment):
class Callspec(object):
'''
Given a Callspec node representing an IDL function declaration, converts into
- a name/value pair where the value is a list of function parameters.
+ a name/value pair, where the value is a tuple of:
not at google - send to devlin 2013/02/21 03:46:03 could you return (name, parameters, return value)
sashab 2013/02/21 22:15:03 Done.
+ (list of function parameters, return type)
'''
def __init__(self, callspec_node, comment):
self.node = callspec_node
@@ -96,12 +97,17 @@ class Callspec(object):
def process(self, callbacks):
parameters = []
+ return_type = None
+ if self.node.GetProperty('TYPEREF') not in ['void', None]:
+ return_type = Typeref(self.node.GetProperty('TYPEREF'),
+ self.node,
+ {'name': self.node.GetName()}).process(callbacks)
not at google - send to devlin 2013/02/21 03:46:03 indentation is wonky
sashab 2013/02/21 22:15:03 Done.
for node in self.node.children:
parameter = Param(node).process(callbacks)
if parameter['name'] in self.comment:
parameter['description'] = self.comment[parameter['name']]
parameters.append(parameter)
- return self.node.GetName(), parameters
+ return self.node.GetName(), (parameters, return_type)
class Param(object):
'''
@@ -161,8 +167,11 @@ class Member(object):
properties['description'] = parent_comment
elif node.cls == 'Callspec':
is_function = True
- name, parameters = Callspec(node, parameter_comments).process(callbacks)
+ name, (parameters, return_type) = (Callspec(node, parameter_comments)
+ .process(callbacks))
properties['parameters'] = parameters
+ if return_type is not None:
+ properties['returns'] = return_type
properties['name'] = name
if is_function:
properties['type'] = 'function'
« tools/json_schema_compiler/dart_generator.py ('K') | « tools/json_schema_compiler/dart_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698