| Index: mojom/generators/go/translator/names.go
|
| diff --git a/mojom/generators/go/translator/names.go b/mojom/generators/go/translator/names.go
|
| index 210ee71cf551068b98d1fa718d21e6326885e385..2b26f7f375e47d88e4b784181de37402c18b13b9 100644
|
| --- a/mojom/generators/go/translator/names.go
|
| +++ b/mojom/generators/go/translator/names.go
|
| @@ -36,12 +36,38 @@ func (t *translator) goTypeName(typeKey string) string {
|
| return goType
|
| }
|
|
|
| +func (t *translator) goConstName(constKey string) (name string) {
|
| + if cachedName, ok := t.goConstNameCache[constKey]; ok {
|
| + return cachedName
|
| + }
|
| +
|
| + declaredConstant := t.fileGraph.ResolvedConstants[constKey]
|
| +
|
| + name = formatName(*declaredConstant.DeclData.ShortName)
|
| + if declaredConstant.DeclData.ContainerTypeKey != nil {
|
| + containerName := t.goTypeName(*declaredConstant.DeclData.ContainerTypeKey)
|
| + name = fmt.Sprintf("%s_%s", containerName, name)
|
| + }
|
| +
|
| + return
|
| +}
|
| +
|
| func fileNameToPackageName(fileName string) string {
|
| base := filepath.Base(fileName)
|
| ext := filepath.Ext(base)
|
| return base[:len(base)-len(ext)]
|
| }
|
|
|
| +func (t *translator) importMojomFile(fileName string) {
|
| + pkgName := fileNameToPackageName(fileName)
|
| + pkgPath, err := filepath.Rel(t.Config.SrcRootPath(), fileName)
|
| + if err != nil {
|
| + panic(err.Error())
|
| + }
|
| + pkgPath = pkgPath[:len(pkgPath)-len(filepath.Ext(pkgPath))]
|
| + t.imports[pkgName] = pkgPath
|
| +}
|
| +
|
| func userDefinedTypeDeclData(userDefinedType mojom_types.UserDefinedType) *mojom_types.DeclarationData {
|
| switch u := userDefinedType.(type) {
|
| case *mojom_types.UserDefinedTypeEnumType:
|
|
|