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

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

Issue 799113004: Update mojo sdk to rev 59145288bae55b0fce4276b017df6a1117bcf00f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add mojo's ply to checklicenses whitelist Created 6 years 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 d87d5fd5758c94fcc6aeb4f99bdf5c1ffe0daaa3..88bd2698ade8e5a1e06e7f654187f877bef1a9c3 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
@@ -103,6 +103,18 @@ class _MojomBuilder(object):
'constants': _MapTreeForType(_ConstToDict, struct.body,
ast.Const)}
+ def UnionToDict(union):
+ def UnionFieldToDict(union_field):
+ assert isinstance(union_field, ast.UnionField)
+ return {'name': union_field.name,
+ 'kind': _MapKind(union_field.typename),
+ 'ordinal': union_field.ordinal.value \
+ if union_field.ordinal else None}
+ assert isinstance(union, ast.Union)
+ return {'name': union.name,
+ 'fields': _MapTreeForType(UnionFieldToDict, union.body,
+ ast.UnionField)}
+
def InterfaceToDict(interface):
def MethodToDict(method):
def ParameterToDict(param):
@@ -140,6 +152,8 @@ class _MojomBuilder(object):
_AttributeListToDict(tree.module.attribute_list) if tree.module else {}
self.mojom['structs'] = \
_MapTreeForType(StructToDict, tree.definition_list, ast.Struct)
+ self.mojom['union'] = \
+ _MapTreeForType(UnionToDict, tree.definition_list, ast.Union)
self.mojom['interfaces'] = \
_MapTreeForType(InterfaceToDict, tree.definition_list, ast.Interface)
self.mojom['enums'] = \

Powered by Google App Engine
This is Rietveld 408576698