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

Unified Diff: tools/json_schema_compiler/js_util.py

Issue 2766363002: [Closure Externs] Handle optional params sent to an API callback (Closed)
Patch Set: Created 3 years, 9 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 | « tools/json_schema_compiler/js_externs_generator_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e563b8889af0bcf03a980cdda55b42f88dfb5d30..064b40b5e28be89a08b50e431355d1cf376c076b 100644
--- a/tools/json_schema_compiler/js_util.py
+++ b/tools/json_schema_compiler/js_util.py
@@ -119,6 +119,8 @@ class JsUtil(object):
c.Append('function(')
for i, param in enumerate(function.params):
c.Concat(self._TypeToJsType(namespace_name, param.type_), new_line=False)
+ if param.optional:
+ c.Append('|undefined', new_line=False)
if i is not len(function.params) - 1:
c.Append(', ', new_line=False, strip_right=False)
c.Append('):', new_line=False)
« no previous file with comments | « tools/json_schema_compiler/js_externs_generator_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698