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

Unified Diff: mojom/generators/go/translator/mojom_file.go

Issue 2045063002: [New go generator] Implement declaring unions. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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: mojom/generators/go/translator/mojom_file.go
diff --git a/mojom/generators/go/translator/mojom_file.go b/mojom/generators/go/translator/mojom_file.go
index d4de4846e8db7d5d3b0ca07d76a9221f2b024b22..c352728df227e8889e3dbefd61af3201982f7e3a 100644
--- a/mojom/generators/go/translator/mojom_file.go
+++ b/mojom/generators/go/translator/mojom_file.go
@@ -10,6 +10,7 @@ type TmplFile struct {
PackageName string
Imports []Import
Structs []*StructTemplate
+ Unions []*UnionTemplate
}
type Import struct {
@@ -69,6 +70,28 @@ type structVersion struct {
Version uint32
}
+type UnionTemplate struct {
+ // Name is the name of the union in go code.
+ Name string
+
+ // Fields contains the list of fields of the union.
+ Fields []UnionFieldTemplate
+}
+
+type UnionFieldTemplate struct {
+ // Name is the name of the field in go.
+ Name string
+
+ // Type is the go type of the field value.
+ Type string
+
+ // Tag of the field.
+ Tag uint32
+
+ // Union is the union containing this field.
+ Union *UnionTemplate
+}
+
////////////////////////////////////////////////////////////////////////////////
// EncodingInfo describes the information necessary to encode a field.

Powered by Google App Engine
This is Rietveld 408576698