Пример #1
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()
}
Пример #2
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)
}