1
0
mirror of https://github.com/MontFerret/ferret.git synced 2024-12-14 11:23:02 +02:00
ferret/pkg/compiler/result.go
3timeslazy de703513e4 Linter Cleanup (#276)
* linter cleanup

* fix default case
2019-03-29 10:48:51 -04:00

27 lines
377 B
Go

package compiler
type visitorFn func() (interface{}, error)
type result struct {
data interface{}
err error
}
func newResultFrom(fn visitorFn) *result {
out, err := fn()
return &result{out, err}
}
func (res *result) Ok() bool {
return res.err == nil
}
func (res *result) Data() interface{} {
return res.data
}
func (res *result) Error() error {
return res.err
}