Exemplo n.º 1
0
        //~ func (w *hashWalker) Exit(loc reflectwalk.Location) error {
        //~     w.loc = reflectwalk.None
        //~
        //~     switch loc {
        //~     case reflectwalk.Map:
        //~         w.cs = w.cs[:len(w.cs)-1]
        //~     case reflectwalk.MapValue:
        //~         w.key = w.key[:len(w.key)-1]
        //~         w.csKey = w.csKey[:len(w.csKey)-1]
        //~     case reflectwalk.Slice:
        //~         w.cs = w.cs[:len(w.cs)-1]
        //~     case reflectwalk.SliceElem:
        //~         w.csKey = w.csKey[:len(w.csKey)-1]
        //~     }
        //~
        //~     return nil
        //~ }
        public void Exit(Location loc)
        {
            this.loc = Location.None;
            switch (loc)
            {
            case Location.Map:
                cs.RemoveAt(cs.Count - 1);
                break;

            case Location.MapValue:
                key.RemoveAt(key.Count - 1);
                break;

            case Location.Slice:
                cs.RemoveAt(cs.Count - 1);
                break;

            case Location.SliceElem:
                csKey.RemoveAt(csKey.Count - 1);
                break;
            }
        }
Exemplo n.º 2
0
 //~ func (w *hashWalker) Enter(loc reflectwalk.Location) error {
 //~     w.loc = loc
 //~     return nil
 //~ }
 public void Enter(Location loc)
 {
     this.loc = loc;
 }