2019-05-01 09:23:05 +00:00
|
|
|
package builtin
|
|
|
|
|
2019-05-01 09:28:55 +00:00
|
|
|
import "git.xdrm.io/go/aicra/typecheck"
|
2019-05-01 09:23:05 +00:00
|
|
|
|
|
|
|
// Any is a permissive type checker
|
|
|
|
type Any struct{}
|
|
|
|
|
|
|
|
// NewAny returns a bare any type checker
|
|
|
|
func NewAny() *Any {
|
|
|
|
return &Any{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Checker returns the checker function
|
2019-05-02 20:15:03 +00:00
|
|
|
func (Any) Checker(typeName string) typecheck.CheckerFunc {
|
2019-05-01 09:23:05 +00:00
|
|
|
// nothing if type not handled
|
|
|
|
if typeName != "any" {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return func(interface{}) bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|