// BorrowTypes gets a slice of Types with size. USE WITH CAUTION.
516668
func BorrowTypes(size int) Types {
	if size > 0 && size < poolSize+1 {
		return typesPool[size-1].Get().(Types)
	}
	return make(Types, size)
}
27421
func (s *ScanService) Types(types ...string) *ScanService {
	if s.types == nil {
		s.types = make([]string, 0)
	}
	s.types = append(s.types, types...)
	return s
}
679898
func (v retainKeysStrategy) MergeType(e apply.TypeElement) (apply.Result, error) {
	// No merge logic if adding or deleting a field
	if result, done := v.merge.doAddOrDelete(&e); done {
		return result, nil
	}

	elem := map[string]apply.Element{}
	for key := range e.GetLocalMap() {
		elem[key] = e.GetValues()[key]
	}
	return v.merge.doMergeMap(elem)
}
171160
func (o *Orderer) OrderTypes(typeList []*types.Type) []*types.Type {
	list := tList{
		namer: o.Namer,
		types: typeList,
	}
	sort.Sort(list)
	return list.types
}
770954
func (g *Generator) CopyType(typeSpec *ast.TypeSpec) error {
	switch t := typeSpec.Type.(type) {
	case *ast.StructType, *ast.MapType, *ast.ChanType, *ast.FuncType, *ast.ArrayType:
		fmt.Fprintf(g, "type %s %s\n", typeSpec.Name.Name, g.TypeOf(typeSpec.Type))
	case *ast.Ident:
		fmt.Fprintf(g, "type %s %s\n", typeSpec.Name.Name, t.Name)
	default:
		return fmt.Errorf("can't copy item of type %T", t)
	}

	return nil
}
50151
func (s *BulkService) Type(typ string) *BulkService {
	s.typ = typ
	return s
}
1004781
func (s *AwsSecurityFinding) SetTypes(v []*string) *AwsSecurityFinding {
	s.Types = v
	return s
}
159840
func (c *ConfigParser) CheckTypes(m map[string]interface{}) error {
	return c.evaluateExpressions(m, nil, true)
}
211515
func ReturnTypes(ts Types) {
	if size := cap(ts); size > 0 && size < poolSize+1 {
		ts = ts[:cap(ts)]
		for i := range ts {
			ts[i] = nil
		}
		typesPool[size-1].Put(ts)
	}
}
1024788
func cachedTypeFields(t reflect.Type) []field {
	m, _ := fieldCache.value.Load().(map[reflect.Type][]field)
	f := m[t]
	if f != nil {
		return f
	}

	// Compute fields without lock.
	// Might duplicate effort but won't hold other computations back.
	f = typeFields(t)
	if f == nil {
		f = []field{}
	}

	fieldCache.mu.Lock()
	m, _ = fieldCache.value.Load().(map[reflect.Type][]field)
	newM := make(map[reflect.Type][]field, len(m)+1)
	for k, v := range m {
		newM[k] = v
	}
	newM[t] = f
	fieldCache.value.Store(newM)
	fieldCache.mu.Unlock()
	return f
}
1368333
func (s *IndicesPutMappingService) UpdateAllTypes(updateAllTypes bool) *IndicesPutMappingService {
	s.updateAllTypes = &updateAllTypes
	return s
}
676027
func (c *Compiler) checkTypes() {
	// Recursion is caught in earlier step, so this cannot fail.
	sorted, _ := c.Graph.Sort()
	checker := newTypeChecker()
	env, errs := checker.CheckTypes(c.TypeEnv, sorted)
	for _, err := range errs {
		c.err(err)
	}
	c.TypeEnv = env
}
1170876
func (v replaceStrategy) MergeType(e apply.TypeElement) (apply.Result, error) {
	return v.doReplace(e)
}
294768
func (b *Builder) FindTypes() (types.Universe, error) {
	// Take a snapshot of pkgs to iterate, since this will recursively mutate
	// b.parsed. Iterate in a predictable order.
	pkgPaths := []string{}
	for pkgPath := range b.parsed {
		pkgPaths = append(pkgPaths, string(pkgPath))
	}
	sort.Strings(pkgPaths)

	u := types.Universe{}
	for _, pkgPath := range pkgPaths {
		if err := b.findTypesIn(importPathString(pkgPath), &u); err != nil {
			return nil, err
		}
	}
	return u, nil
}
1329436
func funcArgsFromType(t reflect.Type) (in []*Parameter, variadic *Parameter, out []*Parameter, err error) {
	nin := t.NumIn()
	if t.IsVariadic() {
		nin--
	}
	var p *Parameter
	for i := 0; i < nin; i++ {
		p, err = parameterFromType(t.In(i))
		if err != nil {
			return
		}
		in = append(in, p)
	}
	if t.IsVariadic() {
		p, err = parameterFromType(t.In(nin).Elem())
		if err != nil {
			return
		}
		variadic = p
	}
	for i := 0; i < t.NumOut(); i++ {
		p, err = parameterFromType(t.Out(i))
		if err != nil {
			return
		}
		out = append(out, p)
	}
	return
}
115365
func (f *FilterOp) IdsByTypes(types []string, ids ...interface{}) *FilterOp {
	f.IdsProp = &IdsFilter{Type: types, Values: ids}
	return f
}
2313
func (c *Inspector) MethodsFromTypes(include []reflect.Type, exclude []reflect.Type) Methods {
	c.parseSource()

	var methods Methods

	var excludes = make(map[string]bool)

	if len(exclude) > 0 {
		for _, m := range c.MethodsFromTypes(exclude, nil) {
			excludes[m.Name] = true
		}
	}

	// There may be overlapping interfaces in types. Do a simple check for now.
	seen := make(map[string]bool)

	nameAndPackage := func(t reflect.Type) (string, string) {
		var name, pkg string

		isPointer := t.Kind() == reflect.Ptr

		if isPointer {
			t = t.Elem()
		}

		pkgPrefix := ""
		if pkgPath := t.PkgPath(); pkgPath != "" {
			pkgPath = strings.TrimSuffix(pkgPath, "/")
			_, shortPath := path.Split(pkgPath)
			pkgPrefix = shortPath + "."
			pkg = pkgPath
		}

		name = t.Name()
		if name == "" {
			// interface{}
			name = t.String()
		}

		if isPointer {
			pkgPrefix = "*" + pkgPrefix
		}

		name = pkgPrefix + name

		return name, pkg

	}

	for _, t := range include {

		for i := 0; i < t.NumMethod(); i++ {

			m := t.Method(i)
			if excludes[m.Name] || seen[m.Name] {
				continue
			}

			seen[m.Name] = true

			if m.PkgPath != "" {
				// Not exported
				continue
			}

			numIn := m.Type.NumIn()

			ownerName, _ := nameAndPackage(t)

			method := Method{Owner: t, OwnerName: ownerName, Name: m.Name}

			for i := 0; i < numIn; i++ {
				in := m.Type.In(i)

				name, pkg := nameAndPackage(in)

				if pkg != "" {
					method.Imports = append(method.Imports, pkg)
				}

				method.In = append(method.In, name)
			}

			numOut := m.Type.NumOut()

			if numOut > 0 {
				for i := 0; i < numOut; i++ {
					out := m.Type.Out(i)
					name, pkg := nameAndPackage(out)

					if pkg != "" {
						method.Imports = append(method.Imports, pkg)
					}

					method.Out = append(method.Out, name)
				}
			}

			methods = append(methods, method)
		}

	}

	sort.SliceStable(methods, func(i, j int) bool {
		mi, mj := methods[i], methods[j]

		wi := c.methodWeight[mi.OwnerName][mi.Name]
		wj := c.methodWeight[mj.OwnerName][mj.Name]

		if wi == wj {
			return mi.Name < mj.Name
		}

		return wi < wj

	})

	return methods

}