Support Elem on lists
This commit is contained in:
parent
bf89042e7b
commit
1a9d040ea4
@ -198,6 +198,10 @@ func (d *decoder) decodeMap(name string, o *hcl.Object, result reflect.Value) er
|
|||||||
// Go through each element and decode it.
|
// Go through each element and decode it.
|
||||||
current := o
|
current := o
|
||||||
for current != nil {
|
for current != nil {
|
||||||
|
if current.Value == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
m := current.Value.([]*hcl.Object)
|
m := current.Value.([]*hcl.Object)
|
||||||
for _, o := range m {
|
for _, o := range m {
|
||||||
// Make the field name
|
// Make the field name
|
||||||
|
@ -69,12 +69,14 @@ func (o *Object) Elem(expand bool) []*Object {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
switch o.Type {
|
if o.Value == nil {
|
||||||
case ValueTypeObject:
|
return nil
|
||||||
if o.Value == nil {
|
}
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
|
switch o.Type {
|
||||||
|
case ValueTypeList:
|
||||||
|
return o.Value.([]*Object)
|
||||||
|
case ValueTypeObject:
|
||||||
return o.Value.([]*Object)
|
return o.Value.([]*Object)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user