Example #1
0
        protected virtual void Visit(MethodReference methodReference, Context context)
        {
            VisitTypeReference(methodReference.ReturnType, context.ReturnType(methodReference));
            VisitTypeReference(methodReference.DeclaringType, context.DeclaringType(methodReference));

            foreach (var genericParameter in methodReference.GenericParameters)
            {
                VisitTypeReference(genericParameter, context.GenericParameter(methodReference));
            }

            foreach (var parameterDefinition in methodReference.Parameters)
            {
                Visit(parameterDefinition, context.Parameter(methodReference));
            }

            var genericInstanceMethod = methodReference as GenericInstanceMethod;

            if (genericInstanceMethod == null)
            {
                return;
            }

            foreach (var genericArgument in genericInstanceMethod.GenericArguments)
            {
                VisitTypeReference(genericArgument, context.GenericArgument(genericInstanceMethod));
            }
        }
Example #2
0
        protected virtual void Visit(MethodDefinition methodDefinition, Context context)
        {
            VisitTypeReference(methodDefinition.ReturnType, context.ReturnType(methodDefinition));

            foreach (var customAttribute in methodDefinition.CustomAttributes)
            {
                Visit(customAttribute, context.Attribute(methodDefinition));
            }

            foreach (var genericParameter in methodDefinition.GenericParameters)
            {
                Visit(genericParameter, context.GenericParameter(methodDefinition));
            }

            foreach (var parameterDefinition in methodDefinition.Parameters)
            {
                Visit(parameterDefinition, context.Parameter(methodDefinition));
            }

            if (!methodDefinition.HasBody)
            {
                return;
            }

            Visit(methodDefinition.Body, context.MethodBody(methodDefinition));
        }
Example #3
0
        protected virtual void Visit(TypeDefinition typeDefinition, Context context)
        {
            if (typeDefinition.BaseType != null)
            {
                VisitTypeReference(typeDefinition.BaseType, context.BaseType(typeDefinition));
            }

            foreach (var customAttribute in typeDefinition.CustomAttributes)
            {
                Visit(customAttribute, context.Attribute(typeDefinition));
            }

            foreach (var typeReference in typeDefinition.Interfaces)
            {
                VisitTypeReference(typeReference, context.Interface(typeDefinition));
            }

            foreach (var genericParameter in typeDefinition.GenericParameters)
            {
                Visit(genericParameter, context.GenericParameter(context));
            }

            foreach (var propertyDefinition in typeDefinition.Properties)
            {
                Visit(propertyDefinition, context.Member(typeDefinition));
            }

            foreach (var fieldDefinition in typeDefinition.Fields)
            {
                Visit(fieldDefinition, context.Member(typeDefinition));
            }

            foreach (var eventDefinition in typeDefinition.Events)
            {
                Visit(eventDefinition, context.Member(typeDefinition));
            }

            foreach (var methodDefinition in typeDefinition.Methods)
            {
                Visit(methodDefinition, context.Member(typeDefinition));
            }

            foreach (var nestedType in typeDefinition.NestedTypes)
            {
                Visit(nestedType, context.NestedType(typeDefinition));
            }
        }
Example #4
0
 protected virtual void Visit(MethodDefinition methodDefinition, Context context)
 {
     this.VisitTypeReference(methodDefinition.ReturnType, context.ReturnType(methodDefinition));
     foreach (Mono.Cecil.CustomAttribute attribute in methodDefinition.CustomAttributes)
     {
         this.Visit(attribute, context.Attribute(methodDefinition));
     }
     foreach (GenericParameter parameter in methodDefinition.GenericParameters)
     {
         this.Visit(parameter, context.GenericParameter(methodDefinition));
     }
     foreach (ParameterDefinition definition in methodDefinition.Parameters)
     {
         this.Visit(definition, context.Parameter(methodDefinition));
     }
     if (methodDefinition.HasBody)
     {
         this.Visit(methodDefinition.Body, context.MethodBody(methodDefinition));
     }
 }
Example #5
0
 protected virtual void Visit(TypeDefinition typeDefinition, Context context)
 {
     if (typeDefinition.BaseType != null)
     {
         this.VisitTypeReference(typeDefinition.BaseType, context.BaseType(typeDefinition));
     }
     foreach (Mono.Cecil.CustomAttribute attribute in typeDefinition.CustomAttributes)
     {
         this.Visit(attribute, context.Attribute(typeDefinition));
     }
     foreach (InterfaceImplementation implementation in typeDefinition.Interfaces)
     {
         this.Visit(implementation, context.Interface(typeDefinition));
     }
     foreach (GenericParameter parameter in typeDefinition.GenericParameters)
     {
         this.Visit(parameter, context.GenericParameter(context));
     }
     foreach (PropertyDefinition definition in typeDefinition.Properties)
     {
         this.Visit(definition, context.Member(typeDefinition));
     }
     foreach (FieldDefinition definition2 in typeDefinition.Fields)
     {
         this.Visit(definition2, context.Member(typeDefinition));
     }
     foreach (MethodDefinition definition3 in typeDefinition.Methods)
     {
         this.Visit(definition3, context.Member(typeDefinition));
     }
     foreach (EventDefinition definition4 in typeDefinition.Events)
     {
         this.Visit(definition4, context.Member(typeDefinition));
     }
     foreach (TypeDefinition definition5 in typeDefinition.NestedTypes)
     {
         this.Visit(definition5, context.NestedType(typeDefinition));
     }
 }
Example #6
0
        protected virtual void Visit(MethodReference methodReference, Context context)
        {
            this.VisitTypeReference(methodReference.ReturnType, context.ReturnType(methodReference));
            this.VisitTypeReference(methodReference.DeclaringType, context.DeclaringType(methodReference));
            foreach (GenericParameter parameter in methodReference.GenericParameters)
            {
                this.VisitTypeReference(parameter, context.GenericParameter(methodReference));
            }
            foreach (ParameterDefinition definition in methodReference.Parameters)
            {
                this.Visit(definition, context.Parameter(methodReference));
            }
            GenericInstanceMethod data = methodReference as GenericInstanceMethod;

            if (data != null)
            {
                foreach (TypeReference reference in data.GenericArguments)
                {
                    this.VisitTypeReference(reference, context.GenericArgument(data));
                }
            }
        }