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

Unified Diff: third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_go_generator.py

Issue 1142043005: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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: third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_go_generator.py
diff --git a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_go_generator.py b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_go_generator.py
index 1df4eb5d1a410e9726362acdfbd32b2a7a8deedd..35e1e99559d6fd4c6023cc38de728dc8d9b77a1d 100644
--- a/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_go_generator.py
+++ b/third_party/mojo/src/mojo/public/tools/bindings/generators/mojom_go_generator.py
@@ -60,6 +60,8 @@ _kind_infos = {
_imports = {}
def GetBitSize(kind):
+ if isinstance(kind, (mojom.Union)):
+ return 128
if isinstance(kind, (mojom.Array, mojom.Map, mojom.Struct, mojom.Interface)):
return 64
if isinstance(kind, (mojom.InterfaceRequest)):
@@ -78,7 +80,7 @@ def GetGoType(kind, nullable = True):
# Returns go type corresponding to provided kind. Ignores nullability of
# top-level kind.
def GetNonNullableGoType(kind):
- if mojom.IsStructKind(kind):
+ if mojom.IsStructKind(kind) or mojom.IsUnionKind(kind):
return '%s' % GetFullName(kind)
if mojom.IsArrayKind(kind):
if kind.length:
@@ -246,6 +248,7 @@ class Generator(generator.Generator):
'is_nullable': mojom.IsNullableKind,
'is_pointer': mojom.IsObjectKind,
'is_struct': mojom.IsStructKind,
+ 'is_union': mojom.IsUnionKind,
'name': GetNameForElement,
'tab_indent': lambda s, size = 1: ('\n' + '\t' * size).join(s.splitlines())
}

Powered by Google App Engine
This is Rietveld 408576698