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

Unified Diff: mojo/public/tools/bindings/pylib/mojom/parse/translate.py

Issue 363033004: Mojo: bindings generator: Add an AST type for parameter lists. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 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: mojo/public/tools/bindings/pylib/mojom/parse/translate.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
index 6b5f4fc33cac743ae2bd034618ba2f66d404c401..cd186f406f355572f41be5ffc6a83bce0d031000 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
@@ -73,19 +73,20 @@ def _MapField(tree):
'default': tree[4]}
def _MapMethod(tree):
+ assert isinstance(tree[2], ast.ParameterList)
+ assert isinstance(tree[3], ast.Ordinal)
+ assert tree[4] is None or isinstance(tree[2], ast.ParameterList)
+
def ParameterToDict(param):
assert isinstance(param, ast.Parameter)
return {'name': param.name,
'kind': _MapKind(param.typename),
'ordinal': param.ordinal.value}
- assert isinstance(tree[2], list)
- assert isinstance(tree[3], ast.Ordinal)
method = {'name': tree[1],
'parameters': map(ParameterToDict, tree[2]),
'ordinal': tree[3].value}
- # Note: |tree[4]| may be an empty list, indicating a parameter-less response.
- if tree[4] is not None:
+ if tree[4]:
method['response_parameters'] = map(ParameterToDict, tree[4])
return method

Powered by Google App Engine
This is Rietveld 408576698