runner: fix empty CUE value check

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-11-24 16:08:40 -08:00
parent b92905e175
commit b5e2ba63c6
3 changed files with 13 additions and 16 deletions

View File

@@ -59,6 +59,11 @@ func (v *Value) Kind() cue.Kind {
return v.val.Kind()
}
// Proxy function to the underlying cue.Value
func (v *Value) IncompleteKind() cue.Kind {
return v.Cue().IncompleteKind()
}
// Field represents a struct field
type Field struct {
Selector cue.Selector
@@ -145,6 +150,10 @@ func (v *Value) List() ([]*Value, error) {
return l, nil
}
func (v *Value) IsConcrete() bool {
return v.val.IsConcrete()
}
// Recursive concreteness check.
func (v *Value) IsConcreteR(opts ...cue.Option) error {
o := []cue.Option{cue.Concrete(true)}
@@ -220,15 +229,6 @@ func (v *Value) Source(opts ...cue.Option) ([]byte, error) {
)
}
func (v *Value) IsEmptyStruct() bool {
if st, err := v.Struct(); err == nil {
if st.Len() == 0 {
return true
}
}
return false
}
func (v *Value) Cue() cue.Value {
return v.val
}
@@ -275,7 +275,3 @@ func (v *Value) Default() (*Value, bool) {
func (v *Value) Doc() []*ast.CommentGroup {
return v.Cue().Doc()
}
func (v *Value) IncompleteKindString() string {
return v.Cue().IncompleteKind().String()
}