Пример #1
0
        public static EnumerableClassInfo <Method, Parameter> SeekEnumerableClass(IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, Expression, Variable, ILogOptions> methodDriver)
        {
            EnumerableHelper <Local, Parameter, Method, Field, Property, Type, Variable, Attribute, Assembly, Expression, ILogOptions> helper =
                new EnumerableHelper <Local, Parameter, Method, Field, Property, Type, Variable, Attribute, Assembly, Expression, ILogOptions>(methodDriver);
            Domain initVal = new Domain();

            methodDriver.CreateForward(helper)(initVal);
            return(helper.ToBeAnalyzed);
        }
        public static void Analyze <Label, Local, Parameter, Method, Field, Type, Expression, Variable>(
            IMethodDriver <Label, Local, Parameter, Method, Field, Type, Expression, Variable> driver,
            bool doDebug
            )
            where Variable : IEquatable <Variable>
        {
            TypeBindings <Label, Local, Parameter, Method, Field, Type, Expression, Variable> .Analysis analysis =
                new TypeBindings <Label, Local, Parameter, Method, Field, Type, Expression, Variable> .Analysis(driver.MetaDataDecoder);

            analysis.Debug = doDebug;
            driver.CreateForward(analysis, doDebug)(analysis.InitialValue(driver.KeyNumber));
        }
        /// <summary>
        /// Main interface method of the analyzer. It returns state machine information, given a method driver.
        /// </summary>
        /// <param name="fullMethodName">The name of the method, should always be "MoveNext".</param>
        /// <param name="driver">A method analysis driver.</param>
        /// <returns></returns>
        public StateMachineInformation <Local> AnalyzeMoveNext <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, Expression, Variable, ILogOptions>(
            string fullMethodName,
            IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver
            )
            where Variable : IEquatable <Variable>
            where Expression : IEquatable <Expression>
            where Type : IEquatable <Type>
            where ILogOptions : IFrameworkLogOptions
        {
            TypeBindings <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, Expression, Variable, ILogOptions> .Analysis analysis =
                new TypeBindings <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, Expression, Variable, ILogOptions> .Analysis(driver, this);

            driver.CreateForward(analysis)(analysis.InitialValue());
            return(analysis.MoveNextPreAnalysisResult);
        }
Пример #4
0
            /// <summary>
            /// It runs the analysis.
            /// It is there because so we can use the typebinding, and make the code less verbose
            /// </summary>
            internal static IMethodResult <Variable> HelperForStringAnalysis(string methodName,
                                                                             IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable, ILogOptions> driver, IValueAnalysisOptions options)
            {
                StringValueAnalysis analysis;

                analysis = new StringValueAnalysis(methodName, driver, options);

                // *** The next lines must be strictly sequential ***
                Action <SimpleStringAbstractDomain <BoxedExpression> > closure = driver.CreateForward <SimpleStringAbstractDomain <BoxedExpression> >(analysis);

                // At this point, CreateForward has called the Visitor, so the context has been created, so that now we can call initValue

                SimpleStringAbstractDomain <BoxedExpression> initValue = analysis.InitialValue;

                closure(initValue); // Do the analysis

                return(analysis);
            }
Пример #5
0
            HelperForPartitionAnalysis(string methodName,
                                       IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable, ILogOptions> driver,
                                       List <Analyzers.Containers.ContainerOptions> optionsList,
                                       IFactQuery <BoxedExpression, Variable> factQuery)
            {
                PartitionAnalysis analysis;

                analysis = new PartitionAnalysis(methodName, driver, optionsList, factQuery);

                // *** The next lines must be strictly sequential ***
                var closure = driver.CreateForward <SimplePartitionAbstractDomain <BoxedVariable <Variable>, BoxedExpression> >(analysis);

                // At this point, CreateForward has called the Visitor, so the context has been created, so that now we can call initValue

                SimplePartitionAbstractDomain <BoxedVariable <Variable>, BoxedExpression> .Trace = optionsList[0].TracePartitionAnalysis;

                var initValue = analysis.InitialValue;

                closure(initValue); // Do the analysis

                return(analysis);
            }