Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Slice location
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Jun 12, 2014
1 parent f74a140 commit e311b7b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions reflectwalk.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
Map
MapKey
MapValue
Slice
SliceElem
StructField
WalkLoc
Expand Down Expand Up @@ -177,6 +178,11 @@ func walkPrimitive(v reflect.Value, w interface{}) error {
}

func walkSlice(v reflect.Value, w interface{}) (err error) {
ew, ok := w.(EnterExitWalker)
if ok {
ew.Enter(Slice)
}

if sw, ok := w.(SliceWalker); ok {
if err := sw.Slice(v); err != nil {
return err
Expand Down Expand Up @@ -206,6 +212,11 @@ func walkSlice(v reflect.Value, w interface{}) (err error) {
}
}

ew, ok = w.(EnterExitWalker)
if ok {
ew.Exit(Slice)
}

return nil
}

Expand Down

0 comments on commit e311b7b

Please sign in to comment.