void MarkMethod(MethodDefinition method)
        {
            if (Annotations.IsMarked(method))
            {
                Context.LogMessage($"Duplicate preserve in {_xmlDocumentLocation} of {method.FullName}");
            }

            Annotations.Mark(method);
            Tracer.AddDirectDependency(this, method);
            Annotations.SetAction(method, MethodAction.Parse);
        }
        protected virtual void ProcessType(TypeDefinition type, XPathNavigator nav)
        {
            if (IsExcluded(nav))
            {
                return;
            }

            TypePreserve preserve = GetTypePreserve(nav);

            if (!IsRequired(nav))
            {
                Annotations.SetPreserve(type, preserve);
                return;
            }

            if (Annotations.IsMarked(type))
            {
                var existingLevel  = Annotations.IsPreserved(type) ? Annotations.GetPreserve(type) : TypePreserve.Nothing;
                var duplicateLevel = preserve != TypePreserve.Nothing ? preserve : nav.HasChildren ? TypePreserve.Nothing : TypePreserve.All;
                Context.LogMessage($"Duplicate preserve in {_xmlDocumentLocation} of {type.FullName} ({existingLevel}).  Duplicate uses ({duplicateLevel})");
            }

            Annotations.MarkAndPush(type);
            Tracer.AddDirectDependency(this, type);

            if (type.IsNested)
            {
                var parent = type;
                while (parent.IsNested)
                {
                    parent = parent.DeclaringType;
                    Annotations.Mark(parent);
                }
            }

            if (preserve != TypePreserve.Nothing)
            {
                Annotations.SetPreserve(type, preserve);
            }

            if (nav.HasChildren)
            {
                MarkSelectedFields(nav, type);
                MarkSelectedMethods(nav, type);
                MarkSelectedEvents(nav, type);
                MarkSelectedProperties(nav, type);
            }
            Tracer.Pop();
        }
Exemple #3
0
        void ProcessType(TypeDefinition type, XPathNavigator nav)
        {
            TypePreserve preserve = GetTypePreserve(nav);

            if (!IsRequired(nav))
            {
                Annotations.SetPreserve(type, preserve);
                return;
            }

            Annotations.MarkAndPush(type);
            Tracer.AddDirectDependency(this, type);

            if (type.IsNested)
            {
                var parent = type;
                while (parent.IsNested)
                {
                    parent = parent.DeclaringType;
                    Annotations.Mark(parent);
                }
            }

            if (preserve != TypePreserve.Nothing)
            {
                Annotations.SetPreserve(type, preserve);
            }

            if (nav.HasChildren)
            {
                MarkSelectedFields(nav, type);
                MarkSelectedMethods(nav, type);
                MarkSelectedEvents(nav, type);
                MarkSelectedProperties(nav, type);
            }
            Tracer.Pop();
        }
Exemple #4
0
 void MarkMethod(MethodDefinition method)
 {
     Annotations.Mark(method);
     Tracer.AddDirectDependency(this, method);
     Annotations.SetAction(method, MethodAction.Parse);
 }