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

Unified Diff: mojom/generators/go/templates/encoding.go

Issue 2082173002: New go generator shakedown. (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/templates/encoding.go
diff --git a/mojom/generators/go/templates/encoding.go b/mojom/generators/go/templates/encoding.go
index b002d15e85737e59a2be55069948f4086707103a..c201bf406a0f61f51fc0705102f4caa17050401e 100644
--- a/mojom/generators/go/templates/encoding.go
+++ b/mojom/generators/go/templates/encoding.go
@@ -15,8 +15,10 @@ const fieldEncodingTmplText = `
if {{$info.Identifier}} == nil {
{{- if $info.IsPointer -}}
encoder.WriteNullPointer()
-{{- else if $info.IsHandle -}}
+{{- else if or $info.IsInterfaceRequest $info.IsHandle -}}
encoder.WriteInvalidHandle()
+{{- else if $info.IsInterface -}}
+ encoder.WriteInvalidInterface()
{{- end -}}
} else {
{{ template "NonNullableFieldEncodingTmpl" $info }}
@@ -70,6 +72,10 @@ if {{$info.Identifier}} == nil {
return err
}
}
+{{- else if $info.IsInterface -}}
+if err := encoder.{{$info.WriteFunction}}({{$info.Identifier}}.PassMessagePipe()); err != nil {
+ return err
+}
{{- else if $info.IsArray -}}
{{ $elInfo := $info.ElementEncodingInfo -}}
encoder.StartArray(uint32(len({{$info.Identifier}})), {{$elInfo.BitSize}})

Powered by Google App Engine
This is Rietveld 408576698