Пример #1
0
 public VariableAccessGraphGenerator(
     ICallGraphGenerator callGraphGenerator,
     Dictionary <VariableInfo, INodeInfoExtractor> infoExtractors)
 {
     this.callGraphGenerator = callGraphGenerator;
     this.infoExtractors     = infoExtractors;
 }
Пример #2
0
        TransitiveCallClosure(
            ICallGraphGenerator callGraphGenerator,
            Node root,
            INodeInfoExtractor variablesExtractor)
        {
            var callGraph        = callGraphGenerator.BuildCallGraph(root);
            var callGraphClosure = callGraph.TransitiveClosure();

            return(AggregateFunctionDeclarations(root).ToDictionary(fun => fun, function =>
            {
                var rootVariables = AggregateFunctionVariablesInfo(function, variablesExtractor);
                var closureVariables = callGraphClosure[function]
                                       .SelectMany(foo => AggregateFunctionVariablesInfo(foo, variablesExtractor));
                return (IReadOnlyCollection <VariableDeclaration>)rootVariables.Concat(closureVariables).ToList();
            }));
        }