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

Unified Diff: tools/json_schema_compiler/idl_schema.py

Issue 11342033: Allow IDL schemas to have comments on callback functions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clarify comment Created 8 years, 1 month 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 1785b3415ef3369ba830ee84edd4dba17f5817ad..30dad11555428459b5b48ff0f9c1e8f92b27381e 100644
--- a/tools/json_schema_compiler/idl_schema.py
+++ b/tools/json_schema_compiler/idl_schema.py
@@ -57,7 +57,7 @@ def ProcessComment(comment):
)
'''
# Find all the parameter comments of the form '|name|: comment'.
- parameter_starts = list(re.finditer(r'\n *\|([^|]*)\| *: *', comment))
+ parameter_starts = list(re.finditer(r' *\|([^|]*)\| *: *', comment))
# Get the parent comment (everything before the first parameter comment.
first_parameter_location = (parameter_starts[0].start()
@@ -229,10 +229,16 @@ class Typeref(object):
properties['type'] = 'function'
else:
if self.typeref in callbacks:
+ # Do not override name and description if they are already specified.
+ name = properties.get('name', None)
+ description = properties.get('description', None)
properties.update(callbacks[self.typeref])
+ if description is not None:
+ properties['description'] = description
+ if name is not None:
+ properties['name'] = name
else:
properties['$ref'] = self.typeref
-
return result
« no previous file with comments | « chrome/common/extensions/docs/templates/private/callback.html ('k') | tools/json_schema_compiler/idl_schema_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698