 Chromium Code Reviews
 Chromium Code Reviews Issue 12316031:
  Fixed problem with non-void return types in IDL  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master
    
  
    Issue 12316031:
  Fixed problem with non-void return types in IDL  (Closed) 
  Base URL: http://git.chromium.org/chromium/src.git@master| 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' |