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

Side by Side Diff: mojom/generators/go/templates/unions.go

Issue 2091493002: Switch to the new go generator in the mojo tree. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix more things. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package templates 5 package templates
6 6
7 import ( 7 import (
8 "text/template" 8 "text/template"
9 ) 9 )
10 10
11 const unionTmplText = ` 11 const unionTmplText = `
12 {{- define "Union" -}} 12 {{- define "Union" -}}
13 {{- $union := . }} 13 {{- $union := . }}
14 {{ template "UnionInterfaceDecl" $union }} 14 {{ template "UnionInterfaceDecl" $union }}
15 15
16 {{ template "UnknownUnionFieldDecl" $union }} 16 {{ template "UnknownUnionFieldDecl" $union }}
17 {{ template "UnknownUnionFieldEncode" $union }} 17 {{ template "UnknownUnionFieldEncode" $union }}
18 18
19 {{- range $field := $union.Field}} 19 {{- range $field := $union.Fields}}
20 {{ template "UnionFieldDecl" $field }} 20 {{ template "UnionFieldDecl" $field }}
21 21
22 {{ template "UnionFieldEncode" $field }} 22 {{ template "UnionFieldEncode" $field }}
23 23
24 {{ template "UnionFieldDecode" $field }} 24 {{ template "UnionFieldDecode" $field }}
25 {{- end}} 25 {{- end}}
26 26
27 {{ template "UnionDecode" $union }} 27 {{ template "UnionDecode" $union }}
28 28
29 {{- end -}} 29 {{- end -}}
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 func initUnionTemplates() { 138 func initUnionTemplates() {
139 template.Must(goFileTmpl.Parse(unionTmplText)) 139 template.Must(goFileTmpl.Parse(unionTmplText))
140 template.Must(goFileTmpl.Parse(unionInterfaceDeclTmplText)) 140 template.Must(goFileTmpl.Parse(unionInterfaceDeclTmplText))
141 template.Must(goFileTmpl.Parse(unionFieldDeclTmplText)) 141 template.Must(goFileTmpl.Parse(unionFieldDeclTmplText))
142 template.Must(goFileTmpl.Parse(unknownUnionFieldDeclTmplText)) 142 template.Must(goFileTmpl.Parse(unknownUnionFieldDeclTmplText))
143 template.Must(goFileTmpl.Parse(unknownUnionFieldEncodeTmplText)) 143 template.Must(goFileTmpl.Parse(unknownUnionFieldEncodeTmplText))
144 template.Must(goFileTmpl.Parse(unionFieldEncodeTmplText)) 144 template.Must(goFileTmpl.Parse(unionFieldEncodeTmplText))
145 template.Must(goFileTmpl.Parse(unionFieldDecodeTmplText)) 145 template.Must(goFileTmpl.Parse(unionFieldDecodeTmplText))
146 template.Must(goFileTmpl.Parse(unionDecodeTmplText)) 146 template.Must(goFileTmpl.Parse(unionDecodeTmplText))
147 } 147 }
OLDNEW
« mojom/generators/go/go_generator.go ('K') | « mojom/generators/go/templates/templates.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698