public VariableAccessGraphGenerator( ICallGraphGenerator callGraphGenerator, Dictionary <VariableInfo, INodeInfoExtractor> infoExtractors) { this.callGraphGenerator = callGraphGenerator; this.infoExtractors = infoExtractors; }
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(); })); }