// findMethod finds method mname in the type of variable v
433928
func (v *Variable) findMethod(mname string) (*Variable, error) {
	if _, isiface := v.RealType.(*godwarf.InterfaceType); isiface {
		v.loadInterface(0, false, loadFullValue)
		if v.Unreadable != nil {
			return nil, v.Unreadable
		}
		return v.Children[0].findMethod(mname)
	}

	typ := v.DwarfType
	ptyp, isptr := typ.(*godwarf.PtrType)
	if isptr {
		typ = ptyp.Type
	}

	if _, istypedef := typ.(*godwarf.TypedefType); !istypedef {
		return nil, nil
	}

	typePath := typ.Common().Name
	dot := strings.LastIndex(typePath, ".")
	if dot < 0 {
		// probably just a C type
		return nil, nil
	}

	pkg := typePath[:dot]
	receiver := typePath[dot+1:]

	if fn, ok := v.bi.LookupFunc[fmt.Sprintf("%s.%s.%s", pkg, receiver, mname)]; ok {
		r, err := functionToVariable(fn, v.bi, v.mem)
		if err != nil {
			return nil, err
		}
		if isptr {
			r.Children = append(r.Children, *(v.maybeDereference()))
		} else {
			r.Children = append(r.Children, *v)
		}
		return r, nil
	}

	if fn, ok := v.bi.LookupFunc[fmt.Sprintf("%s.(*%s).%s", pkg, receiver, mname)]; ok {
		r, err := functionToVariable(fn, v.bi, v.mem)
		if err != nil {
			return nil, err
		}
		if isptr {
			r.Children = append(r.Children, *v)
		} else {
			r.Children = append(r.Children, *(v.pointerToVariable()))
		}
		return r, nil
	}

	return nil, nil
}
672719
func requestMethod(p requestPacket) (method string) {
	switch p.(type) {
	case *sshFxpReadPacket, *sshFxpWritePacket, *sshFxpOpenPacket:
		// set in open() above
	case *sshFxpOpendirPacket, *sshFxpReaddirPacket:
		// set in opendir() above
	case *sshFxpSetstatPacket, *sshFxpFsetstatPacket:
		method = "Setstat"
	case *sshFxpRenamePacket:
		method = "Rename"
	case *sshFxpSymlinkPacket:
		method = "Symlink"
	case *sshFxpRemovePacket:
		method = "Remove"
	case *sshFxpStatPacket, *sshFxpLstatPacket, *sshFxpFstatPacket:
		method = "Stat"
	case *sshFxpRmdirPacket:
		method = "Rmdir"
	case *sshFxpReadlinkPacket:
		method = "Readlink"
	case *sshFxpMkdirPacket:
		method = "Mkdir"
	}
	return method
}
791717
func CallMethod(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) {
	return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_METHOD, params)
}
1335335
func (a *AuthServerStatic) AuthMethod(user string) (string, error) {
	return a.Method, nil
}
699794
func (s *HlsContentProtection) SetMethod(v string) *HlsContentProtection {
	s.Method = &v
	return s
}
1081897
func GetSigningMethod(alg string) (method SigningMethod) {
	signingMethodLock.RLock()
	defer signingMethodLock.RUnlock()

	if methodF, ok := signingMethods[alg]; ok {
		method = methodF()
	}
	return
}
363813
func (ct *ControllerType) Method(name string) *MethodType {
	lowerName := strings.ToLower(name)
	for _, method := range ct.Methods {
		if method.lowerName == lowerName {
			return method
		}
	}
	return nil
}
474842
func MatchesMethod(r *http.Request, m Method) bool {
	return r.Method == m.String()
}
996078
func (o *Option) AddMethod(name string, fn func(vm *ViewModel, args []*js.Object)) *Option {
	return o.addMixin("methods", js.M{
		name: js.MakeFunc(func(this *js.Object, arguments []*js.Object) interface{} {
			vm := newViewModel(this)
			fn(vm, arguments)
			return nil
		}),
	})
}
78796
func (r *Router) Find(method string, path string, c *Context) HandlerFunc {
	_logger.debug("===Find")
	_logger.debug("method:" + method)
	_logger.debug("path:" + path)
	if path[0] == '/' && len(path) > 1 {
		path = path[1:]
	}

	currentNode := r.tree.rootNode
	if path == "/" {
		return currentNode.findHandler(method)
	}

	pathArray := strings.Split(path, "/")
	count := len(pathArray)

	pathParams := make(map[int][]Param)
	var paramsNum int

	for index, element := range pathArray {
		// find static node first
		childNode := currentNode.findChildByName(element)

		if childNode == nil {
			// looking for parameter node
			childNode = currentNode.findChildByKind(pkind)

			if childNode != nil {
				_logger.debugf("parameter node: %s", element)
				var newParams []Param
				for _, pName := range childNode.pNames {
					param := Param{Key: pName, Value: element}
					newParams = append(newParams, param)
				}
				pathParams[paramsNum] = newParams
				paramsNum++
			}
		}

		if childNode == nil {
			// looking for match any node
			childNode = currentNode.findChildByKind(akind)

			if childNode != nil {
				_logger.debugf("match node: %s", element)
				start := 0
				for i := 0; i < index; i++ {
					start += 1 + len(pathArray[i])
				}
				_logger.debugf("start: %d", start)
				_logger.debugf("pname count: %d", len(childNode.pNames))
				var newParams []Param
				for _, pName := range childNode.pNames {
					val := path[start:]
					_logger.debugf("val: %s", val)
					param := Param{Key: pName, Value: val}
					newParams = append(newParams, param)
				}
				pathParams[paramsNum] = newParams
				paramsNum++

				index = count - 1
			}
		}

		if childNode == nil {
			//return notFoundHandler
			return nil
		}

		// last node in the path
		if count == index+1 {
			myHandler := childNode.findHandler(method)
			if myHandler == nil {
				//return notFoundHandler
				_logger.debug("handler was not found")
				return nil
			}

			// var newParams []Param
			// for _, pName := range childNode.pNames {
			// 	param := Param{Key: pName, Value: element}
			// 	newParams = append(newParams, param)
			// }
			// pathParams[paramsNum] = newParams
			// paramsNum++

			paramsNum = 0
			//println("params_count:", len(pathParams))
			_logger.debug("lastNode_params_count:", len(childNode.params))
			for _, validParam := range childNode.params {
				for _, p := range pathParams[paramsNum] {
					if validParam == p.Key {
						_logger.debug("matched: " + validParam + "," + p.Value)
						c.params = append(c.params, p)
					}
				}
				paramsNum++
			}

			return myHandler
		}

		currentNode = childNode
	}
	//return notFoundHandler
	return nil
}
158757
func (mr *MethodRepository) TakeMethod(r *Request) (Handler, *Error) {
	if r.Method == "" || r.Version != Version {
		return nil, ErrInvalidParams()
	}

	mr.m.RLock()
	md, ok := mr.r[r.Method]
	mr.m.RUnlock()
	if !ok {
		return nil, ErrMethodNotFound()
	}

	return md.Handler, nil
}
869624
func parseMethodName(methodName string) (service, method string, _ error) {
	if !strings.HasPrefix(methodName, "/") {
		return "", "", errors.New("invalid method name: should start with /")
	}
	methodName = methodName[1:]

	pos := strings.LastIndex(methodName, "/")
	if pos < 0 {
		return "", "", errors.New("invalid method name: suffix /method is missing")
	}
	return methodName[:pos], methodName[pos+1:], nil
}
880321
func (mr *MethodRepository) RegisterMethod(method string, h Handler, params, result interface{}) error {
	if method == "" || h == nil {
		return errors.New("jsonrpc: method name and function should not be empty")
	}
	mr.m.Lock()
	mr.r[method] = Metadata{
		Handler: h,
		Params:  params,
		Result:  result,
	}
	mr.m.Unlock()
	return nil
}
141018
func findFunction(name string, tmpl *Template) (reflect.Value, bool) {
	if tmpl != nil && tmpl.common != nil {
		if fn := tmpl.execFuncs[name]; fn.IsValid() {
			return fn, true
		}
	}
	if fn := builtinFuncs[name]; fn.IsValid() {
		return fn, true
	}
	return reflect.Value{}, false
}
1226175
func (engine *Engine) NoMethod(handlers ...HandlerFunc) {
	engine.noMethod = handlers
	engine.rebuild405Handlers()
}
391813
func (cs callSet) FindMatch(receiver interface{}, method string, args []interface{}) (*Call, error) {
	key := callSetKey{receiver, method}

	// Search through the expected calls.
	expected := cs.expected[key]
	var callsErrors bytes.Buffer
	for _, call := range expected {
		err := call.matches(args)
		if err != nil {
			fmt.Fprintf(&callsErrors, "\n%v", err)
		} else {
			return call, nil
		}
	}

	// If we haven't found a match then search through the exhausted calls so we
	// get useful error messages.
	exhausted := cs.exhausted[key]
	for _, call := range exhausted {
		if err := call.matches(args); err != nil {
			fmt.Fprintf(&callsErrors, "\n%v", err)
		}
	}

	if len(expected)+len(exhausted) == 0 {
		fmt.Fprintf(&callsErrors, "there are no expected calls of the method %q for that receiver", method)
	}

	return nil, fmt.Errorf(callsErrors.String())
}
576320
func BuildMatchesMethod(mo []string, fx RHandler) RHandler {
	return func(w http.ResponseWriter, r *http.Request, c Collector) {
		MatchesMethod(mo, w, r, c, fx)
	}
}