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

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
« no previous file with comments | « mojom/generators/go/templates/unions_test.go ('k') | mojom/generators/go/translator/translator.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8fced7fce6148d362f8ee15cbfbc48a43deac8c7 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,31 @@ 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 contains the information necessary to encode and decode the field.
+ EncodingInfo EncodingInfo
+}
+
////////////////////////////////////////////////////////////////////////////////
// EncodingInfo describes the information necessary to encode a field.
« no previous file with comments | « mojom/generators/go/templates/unions_test.go ('k') | mojom/generators/go/translator/translator.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698