// FunctionCall	 ::=  FunctionName '(' ( Argument ( ',' Argument )* )? ')'
505447
func (p *parser) parseMethod(n node) node {
	var args []node
	name := p.r.name
	prefix := p.r.prefix

	p.skipItem(itemName)
	p.skipItem(itemLParens)
	if p.r.typ != itemRParens {
		for {
			args = append(args, p.parseExpression(n))
			if p.r.typ == itemRParens {
				break
			}
			p.skipItem(itemComma)
		}
	}
	p.skipItem(itemRParens)
	return newFunctionNode(name, prefix, args)
}
990980
func (mr *MockFacadeCallerMockRecorder) FacadeCall(arg0, arg1, arg2 interface{}) *gomock.Call {
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FacadeCall", reflect.TypeOf((*MockFacadeCaller)(nil).FacadeCall), arg0, arg1, arg2)
}
255783
func (v *evalVisitor) callHelper(name string, helper reflect.Value, node *ast.Expression) interface{} {
	result := v.callFunc(name, helper, v.helperOptions(node))
	if !result.IsValid() {
		return nil
	}

	// @todo We maybe want to ensure here that helper returned a string or a SafeString
	return result.Interface()
}
287599
func NewCallFunctionOnArgs(functionDeclaration string) *CallFunctionOnArgs {
	args := new(CallFunctionOnArgs)
	args.FunctionDeclaration = functionDeclaration
	return args
}
854254
func (s *booleanCompilerVisitor) AcceptCall(v tree.Call) {
	s.err = errors.New("a call was found in an expression - this is likely a programmer error")
}
337325
func (c *Client) Call(procedure string, args []interface{}, kwargs map[string]interface{}) (*Result, error) {
	id := NewID()
	c.registerListener(id)

	call := &Call{
		Request:     id,
		Procedure:   URI(procedure),
		Options:     make(map[string]interface{}),
		Arguments:   args,
		ArgumentsKw: kwargs,
	}
	if err := c.Send(call); err != nil {
		return nil, err
	}

	// wait to receive RESULT message
	msg, err := c.waitOnListener(id)
	if err != nil {
		return nil, err
	} else if e, ok := msg.(*Error); ok {
		return nil, fmt.Errorf("error calling procedure '%v': %v", procedure, e.Error)
	} else if result, ok := msg.(*Result); !ok {
		return nil, fmt.Errorf(formatUnexpectedMessage(msg, RESULT))
	} else {
		return result, nil
	}
}
555655
func (m *MemLogger) LogCall(lvl logging.Level, calldepth int, format string, args []interface{}) {
	if m.lock != nil {
		m.lock.Lock()
		defer m.lock.Unlock()
	}
	if m.data == nil {
		m.data = new([]LogEntry)
	}
	*m.data = append(*m.data, LogEntry{lvl, fmt.Sprintf(format, args...), m.fields, calldepth + 1})
}
103043
func (fcomp *fcomp) args(call *syntax.CallExpr) (op Opcode, arg uint32) {
	var callmode int
	// Compute the number of each kind of parameter.
	var p, n int // number of  positional, named arguments
	var varargs, kwargs syntax.Expr
	for _, arg := range call.Args {
		if binary, ok := arg.(*syntax.BinaryExpr); ok && binary.Op == syntax.EQ {

			// named argument (name, value)
			fcomp.string(binary.X.(*syntax.Ident).Name)
			fcomp.expr(binary.Y)
			n++
			continue
		}
		if unary, ok := arg.(*syntax.UnaryExpr); ok {
			if unary.Op == syntax.STAR {
				callmode |= 1
				varargs = unary.X
				continue
			} else if unary.Op == syntax.STARSTAR {
				callmode |= 2
				kwargs = unary.X
				continue
			}
		}

		// positional argument
		fcomp.expr(arg)
		p++
	}

	// Python2, Python3, and Skylark-in-Java all permit named arguments
	// to appear both before and after a *args argument:
	//   f(1, 2, x=3, *[4], y=5, **dict(z=6))
	//
	// However all three implement different argument evaluation orders:
	//  Python2: 1 2 3 5 4 6 (*args and **kwargs evaluated last)
	//  Python3: 1 2 4 3 5 6 (positional args evaluated before named args)
	//  Skylark-in-Java: 1 2 3 4 5 6 (lexical order)
	//
	// The Skylark-in-Java semantics are clean but hostile to a
	// compiler-based implementation because they require that the
	// compiler emit code for positional, named, *args, more named,
	// and *kwargs arguments and provide the callee with a map of
	// the terrain.
	//
	// For now we implement the Python2 semantics, but
	// the spec needs to clarify the correct approach.
	// Perhaps it would be best if we statically rejected
	// named arguments after *args (e.g. y=5) so that the
	// Python2 implementation strategy matches lexical order.
	// Discussion in github.com/bazelbuild/starlark#13.

	// *args
	if varargs != nil {
		fcomp.expr(varargs)
	}

	// **kwargs
	if kwargs != nil {
		fcomp.expr(kwargs)
	}

	// TODO(adonovan): avoid this with a more flexible encoding.
	if p >= 256 || n >= 256 {
		log.Fatalf("%s: compiler error: too many arguments in call", call.Lparen)
	}

	return CALL + Opcode(callmode), uint32(p<<8 | n)
}
1327837
func (self FunctionCall) Argument(index int) Value {
	return valueOfArrayIndex(self.ArgumentList, index)
}
812075
func call(v reflect.Value, method reflect.Method) reflect.Value {
    funcType := method.Type
    // Method must take no arguments, meaning as a func it has one argument (the receiver)
    if funcType.NumIn() != 1 {
        return reflect.Value{}
    }
    // Method must return a single value.
    if funcType.NumOut() == 0 {
        return reflect.Value{}
    }
    // Result will be the zeroth element of the returned slice.
    return method.Func.Call([]reflect.Value{v})[0]
}
952394
func (fn *Function) CallInternal(thread *Thread, args Tuple, kwargs []Tuple) (Value, error) {
	if debug {
		fmt.Printf("call of %s %v %v\n", fn.Name(), args, kwargs)
	}

	// detect recursion
	for fr := thread.frame.parent; fr != nil; fr = fr.parent {
		// We look for the same function code,
		// not function value, otherwise the user could
		// defeat the check by writing the Y combinator.
		if frfn, ok := fr.Callable().(*Function); ok && frfn.funcode == fn.funcode {
			return nil, fmt.Errorf("function %s called recursively", fn.Name())
		}
	}

	return call(thread, args, kwargs)
}
791717
func CallMethod(disp *ole.IDispatch, name string, params ...interface{}) (result *ole.VARIANT, err error) {
	return disp.InvokeWithOptionalArgs(name, ole.DISPATCH_METHOD, params)
}
987844
func (g *genericFunc) Call(params ...interface{}) interface{} {
	paramsIn := make([]reflect.Value, len(params))
	for i, param := range params {
		paramsIn[i] = reflect.ValueOf(param)
	}
	paramsOut := g.Cache.FnValue.Call(paramsIn)
	if len(paramsOut) >= 1 {
		return paramsOut[0].Interface()
	}
	return nil
}
968725
func (a actions) call(r, c interface{}) (interface{}, error) {
	return a[0](r, c, a)
}
677226
func (b ValExprBuilder) Func(name string) ValExprBuilder {
	return b.makeFunc(name, false)
}
1086404
func (scope *Scope) callMethod(methodName string, reflectValue reflect.Value) {
	// Only get address from non-pointer
	if reflectValue.CanAddr() && reflectValue.Kind() != reflect.Ptr {
		reflectValue = reflectValue.Addr()
	}

	if methodValue := reflectValue.MethodByName(methodName); methodValue.IsValid() {
		switch method := methodValue.Interface().(type) {
		case func():
			method()
		case func(*Scope):
			method(scope)
		case func(*DB):
			newDB := scope.NewDB()
			method(newDB)
			scope.Err(newDB.Error)
		case func() error:
			scope.Err(method())
		case func(*Scope) error:
			scope.Err(method(scope))
		case func(*DB) error:
			newDB := scope.NewDB()
			scope.Err(method(newDB))
			scope.Err(newDB.Error)
		default:
			scope.Err(fmt.Errorf("unsupported function %v", methodName))
		}
	}
}
1108158
func (self FunctionCall) CallerLocation() string {
	// see error.go for location()
	return self.runtime.scope.outer.frame.location()
}