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

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

Issue 2077113002: Handle interfaces with a ServiceName in the go bindings generator. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix names issue. 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/translator/translator.go ('k') | mojom/generators/go/translator/types_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojom/generators/go/translator/types.go
diff --git a/mojom/generators/go/translator/types.go b/mojom/generators/go/translator/types.go
index c76afe61e14bf928779871e20ccfc8e117042971..2b8390d9bb74d79e2cb644c557c34c44fcd216b8 100644
--- a/mojom/generators/go/translator/types.go
+++ b/mojom/generators/go/translator/types.go
@@ -121,7 +121,18 @@ func (t *translator) translateMapType(mojomType mojom_types.MapType) (goType str
}
func (t *translator) translateTypeReference(typeRef mojom_types.TypeReference) (goType string) {
- // TODO(azani): Handle interface requests.
// TOOD(azani): Handle imported types.
- return t.goTypeName(*typeRef.TypeKey)
+ typeKey := *typeRef.TypeKey
+ userDefinedType := t.fileGraph.ResolvedTypes[typeKey]
+ typeName := t.goTypeName(*typeRef.TypeKey)
+
+ if _, ok := userDefinedType.(*mojom_types.UserDefinedTypeInterfaceType); ok {
+ if typeRef.IsInterfaceRequest {
+ return fmt.Sprintf("%s_Proxy", typeName)
+ } else {
+ return fmt.Sprintf("%s_Pointer", typeName)
+ }
+ }
+
+ return typeName
}
« no previous file with comments | « mojom/generators/go/translator/translator.go ('k') | mojom/generators/go/translator/types_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698