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

Unified Diff: tools/json_schema_compiler/js_util.py

Issue 2601333002: Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Address lots of feedback Created 3 years, 11 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/js_util.py
diff --git a/tools/json_schema_compiler/js_util.py b/tools/json_schema_compiler/js_util.py
index 2549aefa2fae4966eee2c0f1fe4fef67667b82a7..740b2fc84586e444f8733b59d9eb54a7df578737 100644
--- a/tools/json_schema_compiler/js_util.py
+++ b/tools/json_schema_compiler/js_util.py
@@ -101,6 +101,18 @@ class JsUtil(object):
c.Eblock(' */')
+ def AppendTypeJsDoc(self, c, namespace_name, js_type, optional):
Dan Beam 2017/01/11 23:04:26 s/optional/nullable/ optional means {type=} in JS
dmazzoni 2017/01/11 23:23:57 Done.
+ """Appends the documentation for a type as a Code.
+ """
+ c.Append('@type {')
+ js_type_str = self._TypeToJsType(namespace_name, js_type).Render()
+ if optional:
+ if js_type_str[0] == '!':
Dan Beam 2017/01/11 23:04:26 when does a nullable param have a !Type? these ar
dmazzoni 2017/01/11 23:23:57 Exactly, but _TypeToJsType, below, always adds '!'
+ js_type_str = js_type_str[1:]
+ js_type_str = '?' + js_type_str
+ c.Append(js_type_str, new_line=False)
+ c.Append('}', new_line=False)
+
def _FunctionToJsFunction(self, namespace_name, function):
"""Converts a model.Function to a JS type (i.e., function([params])...)"""
c = Code()

Powered by Google App Engine
This is Rietveld 408576698