// See if name is a method of the value at some level of indirection.
// The return values are the result of the call (which may be nil if
// there's trouble) and whether a method of the right name exists with
// any signature.
349161
func callMethod(data reflect.Value, name string) (result reflect.Value, found bool) {
    found = false
    // Method set depends on pointerness, and the value may be arbitrarily
    // indirect.  Simplest approach is to walk down the pointer chain and
    // see if we can find the method at each step.
    // Most steps will see NumMethod() == 0.
    for {
        typ := data.Type()
        if nMethod := data.Type().NumMethod(); nMethod > 0 {
            for i := 0; i < nMethod; i++ {
                method := typ.Method(i)
                if method.Name == name {

                    found = true // we found the name regardless
                    // does receiver type match? (pointerness might be off)
                    if typ == method.Type.In(0) {
                        return call(data, method), found
                    }
                }
            }
        }
        if nd := data; nd.Kind() == reflect.Ptr {
            data = nd.Elem()
        } else {
            break
        }
    }
    return
}
1039786
func (in *Inputs) GetParameterByName(name string) *Parameter {
	for _, param := range in.Parameters {
		if param.Name == name {
			return &param
		}
	}
	return nil
}
434304
func isIncorrectName(name string) bool {
	if len(name) == 0 {
		return true
	}
	if name[len(name)-1] == ' ' {
		return true
	}
	return false
}
534132
func (mem *memNamedMapping) GetValue(name string) (value interface{}, exists bool) {
	mem.access.RLock()
	defer mem.access.RUnlock()

	item, found := mem.nameToIdx[name]
	if found {
		return item.value, found
	}
	return
}
1325353
func (m *Monitor) Name() string {
	var name string
	mainthread.Call(func() {
		name = m.monitor.GetName()
	})
	return name
}
194713
func (v *evalVisitor) evalMethod(ctx reflect.Value, name string, exprRoot bool) (reflect.Value, bool) {
	if ctx.Kind() != reflect.Interface && ctx.CanAddr() {
		ctx = ctx.Addr()
	}

	method := ctx.MethodByName(name)
	if !method.IsValid() {
		// example: subject() => Subject()
		method = ctx.MethodByName(strings.Title(name))
	}

	if !method.IsValid() {
		return zero, false
	}

	return v.evalFieldFunc(name, method, exprRoot), true
}
670258
func indirect(a interface{}) interface{} {
	if a == nil {
		return nil
	}
	if t := reflect.TypeOf(a); t.Kind() != reflect.Ptr {
		// Avoid creating a reflect.Value if it's not a pointer.
		return a
	}
	v := reflect.ValueOf(a)
	for v.Kind() == reflect.Ptr && !v.IsNil() {
		v = v.Elem()
	}
	return v.Interface()
}
33096
func (mock *Mock) getReturnValues(name string) (response []interface{}) {
	for i, resp := range mock.responses {
		if resp.methodName == name {
			// Remove used response but retain order
			mock.responses = append(mock.responses[:i], mock.responses[i+1:]...)
			return resp.items
		}
	}
	// Return empty response
	return
}
1204895
func (mr *MockModelCacheMockRecorder) Name() *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockModelCache)(nil).Name))
}
1023244
func GetMethods(m string) []string {
	var methods []string

	if m != "" {
		cln := multispaces.ReplaceAllString(m, " ")
		methods = multispaces.Split(cln, -1)
	}

	return methods
}
167306
func (p *gc_parser) parse_method_or_embed_spec() *ast.Field {
	name, nameexpr := p.parse_name()
	if p.tok == '(' {
		typ := p.parse_signature()
		return &ast.Field{
			Names: []*ast.Ident{ast.NewIdent(name)},
			Type:  typ,
		}
	}

	return &ast.Field{
		Type: nameexpr,
	}
}
771698
func (mc MongoClient) ValueDescriptorByName(name string) (contract.ValueDescriptor, error) {
	mvd, err := mc.getValueDescriptor(bson.M{"name": name})
	if err != nil {
		return contract.ValueDescriptor{}, err
	}
	return mvd.ToContract(), nil
}
1265538
func (m Method) DeclarationNamed(receiver string) string {
	return fmt.Sprintf("func (%s %s) %s%s %s", receiverShort(receiver), receiver, m.Name, m.inStr(), m.outStrNamed())
}
60183
func funcName(fn *ast.FuncDecl) string {
	if fn.Recv != nil {
		if fn.Recv.NumFields() > 0 {
			typ := fn.Recv.List[0].Type
			return fmt.Sprintf("(%s).%s", recvString(typ), fn.Name)
		}
	}
	return fn.Name.Name
}
292645
func methodFilter(name string) (bool, error) {
	if ok, _ := regexp.MatchString("^Test", name); !ok {
		return false, nil
	}
	return regexp.MatchString(*matchMethod, name)
}
521829
func HasMethod(mo []string, m string) bool {
	var found bool
	m = strings.ToLower(m)

	for _, mi := range mo {
		if m != mi {
			continue
		}
		found = true
		break
	}

	return found
}
1167693
func (mr *MockFacadeCallerMockRecorder) Name() *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockFacadeCaller)(nil).Name))
}