Esempio n. 1
0
        protected virtual void Visit(Instruction instruction, Context context)
        {
            if (instruction.Operand == null)
            {
                return;
            }

            if (instruction.Operand is Instruction)
            {
                return;
            }

            var fieldReference = instruction.Operand as FieldReference;

            if (fieldReference != null)
            {
                Visit(fieldReference, context.Operand(instruction));
                return;
            }

            var methodReference = instruction.Operand as MethodReference;

            if (methodReference != null)
            {
                Visit(methodReference, context.Operand(instruction));
                return;
            }

            var typeReference = instruction.Operand as TypeReference;

            if (typeReference != null)
            {
                VisitTypeReference(typeReference, context.Operand(instruction));
                return;
            }

            var parameterDefinition = instruction.Operand as ParameterDefinition;

            if (parameterDefinition != null)
            {
                Visit(parameterDefinition, context.Operand(instruction));
                return;
            }

            var variableDefinition = instruction.Operand as VariableDefinition;

            if (variableDefinition != null)
            {
                Visit(variableDefinition, context.Operand(instruction));
            }
        }
Esempio n. 2
0
 protected virtual void Visit(Instruction instruction, Context context)
 {
     if ((instruction.Operand != null) && !(instruction.Operand is Instruction))
     {
         FieldReference operand = instruction.Operand as FieldReference;
         if (operand != null)
         {
             this.Visit(operand, context.Operand(instruction));
         }
         else
         {
             MethodReference methodReference = instruction.Operand as MethodReference;
             if (methodReference != null)
             {
                 this.Visit(methodReference, context.Operand(instruction));
             }
             else
             {
                 TypeReference typeReference = instruction.Operand as TypeReference;
                 if (typeReference != null)
                 {
                     this.VisitTypeReference(typeReference, context.Operand(instruction));
                 }
                 else
                 {
                     ParameterDefinition parameterDefinition = instruction.Operand as ParameterDefinition;
                     if (parameterDefinition != null)
                     {
                         this.Visit(parameterDefinition, context.Operand(instruction));
                     }
                     else
                     {
                         VariableDefinition variableDefinition = instruction.Operand as VariableDefinition;
                         if (variableDefinition != null)
                         {
                             this.Visit(variableDefinition, context.Operand(instruction));
                         }
                     }
                 }
             }
         }
     }
 }