Exemplo n.º 1
0
 public void AddCodeVisitor(CodeVisitorBase visitor, object key)
 {
     if (visitor == null) throw new ArgumentNullException("visitor");
       if (key == null) throw new ArgumentNullException("key");
       CompositeCodeVisitor visitorsForType;
       _visitors.TryGetValue(key, out visitorsForType);
       if (visitorsForType == null) {
     visitorsForType = new CompositeCodeVisitor();
     _visitors.Add(key, visitorsForType);
       }
       visitorsForType.AddCodeVisitor(visitor);
 }
Exemplo n.º 2
0
        public void BeginVisitingType(TypeDefinition typeBeingVisited)
        {
            if (typeBeingVisited == null) throw new ArgumentNullException("typeBeingVisited");

              _currentVisitor = null;

              AddVisitorToCurrentComposite(typeBeingVisited);

              // include all enclosing types from the type being visited
              GetEnclosingTypes(typeBeingVisited).ForEach(et => AddVisitorToCurrentComposite(et));

              AddVisitorToCurrentComposite(AssemblyKey); // AssemblyKey indicates that the visitor is valid for all types
        }
Exemplo n.º 3
0
 public void EndVisitingType()
 {
     _currentVisitor = null;
 }
Exemplo n.º 4
0
 private void AddVisitorToCurrentComposite(object visitorKey)
 {
     CompositeCodeVisitor visitor;
       _visitors.TryGetValue(visitorKey, out visitor);
       if (visitor != null) {
     if (_currentVisitor == null) _currentVisitor = new CompositeCodeVisitor();
     _currentVisitor.AddCodeVisitor(visitor);
       }
 }