Index: third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_python_generator.py |
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_python_generator.py b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_python_generator.py |
index 6fc5b976a43b304de9bb4495ab08a3b81499fc27..1f726b6699a9bb31ba226dc39885df38006be90b 100644 |
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_python_generator.py |
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_python_generator.py |
@@ -81,7 +81,8 @@ def FieldStyle(name): |
def GetNameForElement(element): |
if (mojom.IsEnumKind(element) or mojom.IsInterfaceKind(element) or |
- mojom.IsStructKind(element) or isinstance(element, mojom.Method)): |
+ mojom.IsStructKind(element) or mojom.IsUnionKind(element) or |
+ isinstance(element, mojom.Method)): |
return UpperCamelCase(element.name) |
if isinstance(element, mojom.EnumValue): |
return (GetNameForElement(element.enum) + '.' + |
@@ -145,7 +146,7 @@ def GetFieldType(kind, field=None): |
arguments.append('nullable=True') |
return '_descriptor.MapType(%s)' % ', '.join(arguments) |
- if mojom.IsStructKind(kind): |
+ if mojom.IsStructKind(kind) or mojom.IsUnionKind(kind): |
arguments = [ 'lambda: %s' % GetFullyQualifiedName(kind) ] |
if mojom.IsNullableKind(kind): |
arguments.append('nullable=True') |