| 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'] = \
|
|
|