Example #1
0
func logFunctionCall(callable types.FuCallable, args types.ArgSource) {
	argstrings := make([]string, len(args.Args()))
	for i, arg := range args.Args() {
		argstrings[i] = arg.String()
	}
	log.Info("%s(%s)", callable.Name(), strings.Join(argstrings, ", "))
}
Example #2
0
func Test_PythonCallable(t *testing.T) {
	var callable types.FuCallable
	callable = MakePythonCallable("fred", nil)
	assert.Equal(t, "fred", callable.Name())
	assert.Equal(t, "python:fred()", callable.String())
	assert.Equal(t, "fred", callable.ValueString())

	_ = callable.Code()
}
Example #3
0
func (self *Runtime) evaluateCall(
	callable types.FuCallable,
	args RuntimeArgs,
	precall func(types.FuCallable, types.ArgSource)) (
	types.FuObject, []error) {

	if precall != nil {
		precall(callable, args)
	}
	err := callable.CheckArgs(args)
	if err != nil {
		return nil, []error{err}
	}
	return callable.Code()(args)
}