Example #1
0
        protected UCFG GetUcfgForMethod(string code, string methodName)
        {
            (var method, var semanticModel) = TestHelper.Compile(code, Verifier.SystemWebMvcAssembly).GetMethod(methodName);

            var builder = new UniversalControlFlowGraphBuilder();

            return(builder.Build(semanticModel, method,
                                 semanticModel.GetDeclaredSymbol(method), CSharpControlFlowGraph.Create(method.Body, semanticModel)));
        }
Example #2
0
        private static UCFG CreateUcfgForConstructor(string code, string name)
        {
            var(syntaxTree, semanticModel) = TestHelper.Compile(code, Verifier.SystemWebMvcAssembly);

            var ctor = syntaxTree.GetRoot()
                       .DescendantNodes()
                       .OfType <ConstructorDeclarationSyntax>()
                       .First(m => m.Identifier.ValueText == name);

            var builder = new UniversalControlFlowGraphBuilder();

            var ucfg = builder.Build(semanticModel, ctor,
                                     semanticModel.GetDeclaredSymbol(ctor), CSharpControlFlowGraph.Create(ctor.Body, semanticModel));

            return(ucfg);
        }