xgo/objects/builtin_function.go
2019-01-09 19:07:03 -08:00

37 lines
683 B
Go

package objects
import (
"github.com/d5/tengo/token"
)
type BuiltinFunction struct {
Value BuiltinFunc
}
func (o *BuiltinFunction) TypeName() string {
return "builtin-function"
}
func (o *BuiltinFunction) String() string {
return "<builtin-function>"
}
func (o *BuiltinFunction) BinaryOp(op token.Token, rhs Object) (Object, error) {
return nil, ErrInvalidOperator
}
func (o *BuiltinFunction) Copy() Object {
return &BuiltinFunction{Value: o.Value}
}
func (o *BuiltinFunction) IsFalsy() bool {
return false
}
func (o *BuiltinFunction) Equals(x Object) bool {
return false
}
func (o *BuiltinFunction) Call(args ...Object) (Object, error) {
return o.Value(args...)
}