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

Unified Diff: mojom/generators/go/translator/names.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/mojom_file.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/names.go
diff --git a/mojom/generators/go/translator/names.go b/mojom/generators/go/translator/names.go
index 582484188a33f1825c172db0272dd49a9b7ece96..f95849d205d296ab949d819f3414dc937da92129 100644
--- a/mojom/generators/go/translator/names.go
+++ b/mojom/generators/go/translator/names.go
@@ -42,21 +42,25 @@ func fileNameToPackageName(fileName string) string {
return base[:len(base)-len(ext)]
}
-// userDefinedTypeShortName extracts the ShortName from a user-defined type.
-func userDefinedTypeShortName(userDefinedType mojom_types.UserDefinedType) string {
+func userDefinedTypeDeclData(userDefinedType mojom_types.UserDefinedType) *mojom_types.DeclarationData {
switch u := userDefinedType.(type) {
case *mojom_types.UserDefinedTypeEnumType:
- return *u.Value.DeclData.ShortName
+ return u.Value.DeclData
case *mojom_types.UserDefinedTypeStructType:
- return *u.Value.DeclData.ShortName
+ return u.Value.DeclData
case *mojom_types.UserDefinedTypeUnionType:
- return *u.Value.DeclData.ShortName
+ return u.Value.DeclData
case *mojom_types.UserDefinedTypeInterfaceType:
- return *u.Value.DeclData.ShortName
+ return u.Value.DeclData
}
panic("Non-handled mojom UserDefinedType. This should never happen.")
}
+// userDefinedTypeShortName extracts the ShortName from a user-defined type.
+func userDefinedTypeShortName(userDefinedType mojom_types.UserDefinedType) string {
+ return *userDefinedTypeDeclData(userDefinedType).ShortName
+}
+
// privateName accepts a string and returns that same string with the first rune
// set to lowercase.
func privateName(name string) string {
« no previous file with comments | « mojom/generators/go/translator/mojom_file.go ('k') | mojom/generators/go/translator/translator.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698