// TypeName returns the fully-qualified type name for this expression.
// The caller may optionally specify a package name to override the default.
514196
func (e TypeExpr) TypeName(pkgOverride string) string {
	pkgName := FirstNonEmpty(pkgOverride, e.PkgName)
	if pkgName == "" {
		return e.Expr
	}
	return e.Expr[:e.pkgIndex] + pkgName + "." + e.Expr[e.pkgIndex:]
}
52695
func typeToUrlName(i interface{}) string {
	name, ok := i.(string)
	if !ok {
		name = fmt.Sprintf("%T", i)
	}
	pair := strings.Split(name, ".")
	if len(pair) != 2 {
		panic(fmt.Sprintf("unable to understand type name: %s", name))
	}
	return strings.ToLower(pair[1])
}
501900
func (s *ResultAttribute) SetTypeName(v string) *ResultAttribute {
	s.TypeName = &v
	return s
}
680453
func (s *InventoryItemSchema) SetTypeName(v string) *InventoryItemSchema {
	s.TypeName = &v
	return s
}
1100613
func (v *Variable) TypeString() string {
	if v == nilVariable {
		return "nil"
	}
	if v.DwarfType != nil {
		return v.DwarfType.Common().Name
	}
	return v.Kind.String()
}
1172106
func (g *Generator) BuildTypeNameMap() {
	g.typeNameToObject = make(map[string]Object)
	for _, f := range g.allFiles {
		// The names in this loop are defined by the proto world, not us, so the
		// package name may be empty.  If so, the dotted package name of X will
		// be ".X"; otherwise it will be ".pkg.X".
		dottedPkg := "." + f.GetPackage()
		if dottedPkg != "." {
			dottedPkg += "."
		}
		for _, enum := range f.enum {
			name := dottedPkg + dottedSlice(enum.TypeName())
			g.typeNameToObject[name] = enum
		}
		for _, desc := range f.desc {
			name := dottedPkg + dottedSlice(desc.TypeName())
			g.typeNameToObject[name] = desc
		}
	}
}
124747
func (s *GetTypeInput) SetTypeName(v string) *GetTypeInput {
	s.TypeName = &v
	return s
}
705962
func (s *ElasticsearchDestinationConfiguration) SetTypeName(v string) *ElasticsearchDestinationConfiguration {
	s.TypeName = &v
	return s
}
548263
func (s *CreateThingInput) SetThingTypeName(v string) *CreateThingInput {
	s.ThingTypeName = &v
	return s
}
84510
func (s *ListThingsInput) SetThingTypeName(v string) *ListThingsInput {
	s.ThingTypeName = &v
	return s
}
769010
func generateTypeNameGetter(w io.Writer, structName, msgName string) {
	fmt.Fprintf(w, `func (*%s) GetTypeName() string {
	return %q
}
`, structName, msgName)
}
1112791
func (g *Generator) ExpressionType(e ast.Expr) (types.Type, error) {
	for _, info := range g.Program.AllPackages {
		if typesType := info.TypeOf(e); typesType != nil {
			return typesType, nil
		}
	}

	return nil, fmt.Errorf("expression not found: %+v", e)
}
604161
func (g *Plugin) typeName(str string) string {
	return g.gen.TypeName(g.objectNamed(str))
}
805934
func (s *ListResolversInput) SetTypeName(v string) *ListResolversInput {
	s.TypeName = &v
	return s
}
906582
func (g *Generator) typeOf(tt types.Type) string {
	switch t := tt.(type) {
	case *types.Chan:
		return chanPrefixes[t.Dir()] + g.typeOf(t.Elem())
	case *types.Pointer:
		return "*" + g.typeOf(t.Elem())
	case *types.Array:
		return fmt.Sprintf("[%d]%s", t.Len(), g.typeOf(t.Elem()))
	case *types.Slice:
		return "[]" + g.typeOf(t.Elem())
	case *types.Map:
		return "map[" + g.typeOf(t.Key()) + "]" + g.typeOf(t.Elem())
	case *types.Struct:
		name := "struct{\n"
		for i := 0; i < t.NumFields(); i++ {
			field := t.Field(i)
			if !field.Anonymous() {
				name += field.Name()
			}
			name += " " + g.typeOf(field.Type())

			if t.Tag(i) != "" {
				name += fmt.Sprintf(" `%s`\n", t.Tag(i))
			} else {
				name += "\n"
			}
		}
		return name + "\n}"
	case *types.Signature:
		signature, err := g.FuncSignature(t)
		if err != nil {
			log.Fatalf("failed to get func signature: %v", err)
		}

		return "func" + signature
	case *types.Named:
		fullName := t.Obj().Type().String()
		if convertTo, ok := g.typeConversions[fullName]; ok {
			fullName = convertTo
		}

		i := strings.LastIndex(fullName, ".")
		if i == -1 {
			return fullName
		}

		pkgPath := fullName[0:i]
		name := fullName[i+1:]

		selector := g.PackageSelector(pkgPath)
		if selector == "" {
			return name
		}

		return selector + "." + name
	case *types.Basic:
		return t.Name()
	case *types.Interface:
		return "interface{}"
	default:
		log.Fatalf("Can't generate local type name for type %T: %v", t, t)
	}

	return ""
}
763430
func (g *Generator) DefaultPackageName(obj Object) string {
	pkg := obj.PackageName()
	if pkg == g.packageName {
		return ""
	}
	return pkg + "."
}
193506
func (d *Descriptor) TypeName() []string {
	if d.typename != nil {
		return d.typename
	}
	n := 0
	for parent := d; parent != nil; parent = parent.parent {
		n++
	}
	s := make([]string, n)
	for parent := d; parent != nil; parent = parent.parent {
		n--
		s[n] = parent.GetName()
	}
	d.typename = s
	return s
}