示例#1
0
 public CallQuery(
     ICodeProvider <Label, Local, Parameter, Method, Field, Type> codeProvider,
     CallGraphOrder <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> parent,
     Node currentNode
     )
 {
     this.codeProvider = codeProvider;
     this.parent       = parent;
     this.currentNode  = currentNode;
 }
        private IMethodNumbers <Method, Type> MethodOrder(Assembly assembly)
        {
            // Currently use MethodOrder to get the list of methods to analyze

            IMethodOrder <Method, Type> methodOrder;

            if (this.options.MayPropagateInferredRequiresOrEnsures)
            {
                methodOrder = new CallGraphOrder <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>(
                    true, this.mdDecoder, this.contractDecoder, this.environment.AssembliesUnderAnalysis, this.fieldsDB, this.cancellationToken);
            }
            else
            {
                methodOrder = new ProtectionBasedMethodOrder <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly>(
                    this.mdDecoder, this.driver.ContractDecoder, this.fieldsDB, this.cancellationToken);
            }

            methodOrder.AddFilter((m, i) => this.options.analyzeFrom <= i && i <= this.options.analyzeTo);
            if (this.options.select != null && this.options.select.Count > 0)
            {
                methodOrder.AddFilter((m, i) => this.options.select.Contains(i));
            }

            if (!String.IsNullOrEmpty(this.options.NamespaceSelect))
            {
                methodOrder.AddFilter((m, i) => this.mdDecoder.Namespace(this.mdDecoder.DeclaringType(m)).StartsWith(this.options.NamespaceSelect));
            }

            if (!String.IsNullOrEmpty(this.options.TypeNameSelect))
            {
                methodOrder.AddFilter((m, i) => this.mdDecoder.FullName(this.mdDecoder.DeclaringType(m)) == this.options.TypeNameSelect);
            }

            if (!String.IsNullOrEmpty(this.options.memberNameSelect))
            {
                methodOrder.AddFilter((m, i) => this.mdDecoder.DeclaringMemberCanonicalName(m) == this.options.memberNameSelect);
            }

            // WriteLinePhase(output, "Ordering the methods");
            foreach (var t in this.mdDecoder.GetTypes(assembly))
            {
                methodOrder.AddType(t);
            }

            return(new MethodNumbers <Method, Type>(this.methodNumbering, methodOrder, this.options.includeCalleesTransitively));
        }
示例#3
0
 public ContractConsumer(CallGraphOrder <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly> parent)
 {
     this.parent = parent;
 }