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

Unified Diff: tools/json_schema_compiler/idl_schema.py

Issue 10054039: Support array types for function and callback arguments in IDL APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 8 years, 8 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
« no previous file with comments | « no previous file | tools/json_schema_compiler/idl_schema_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9779e272e263180a22dc0b707e08dade001e6296..1d3c83ae3b9652767c0f73ec4e56601d8e2b933c 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -108,10 +108,20 @@ class Typeref(object):
def process(self, refs):
properties = self.additional_properties
+ result = properties
if self.parent.GetProperty('OPTIONAL', False):
properties['optional'] = True
+ # The IDL parser denotes array types by adding a child 'Array' node onto
+ # the Param node in the Callspec.
+ for sibling in self.parent.GetChildren():
+ if sibling.cls == 'Array' and sibling.GetName() == self.parent.GetName():
+ properties['type'] = 'array'
+ properties['items'] = {}
+ properties = properties['items']
+ break
+
if self.typeref == 'DOMString':
properties['type'] = 'string'
elif self.typeref == 'boolean':
@@ -132,10 +142,11 @@ class Typeref(object):
properties['type'] = 'function'
else:
try:
- properties = refs[self.typeref]
+ result = refs[self.typeref]
Matt Perry 2012/04/12 18:56:53 What is this code path used for? Doesn't this miss
except KeyError, e:
properties['$ref'] = self.typeref
- return properties
+
+ return result
class Namespace(object):
'''
« no previous file with comments | « no previous file | tools/json_schema_compiler/idl_schema_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698