internal InMethodChangeSignatureDetector(IDocument docBefore, IDocument docAfter, SyntaxNode beforeMethod, SyntaxNode afterMethod) { this.docBefore = docBefore; this.docAfter = docAfter; this.beforeMethod = beforeMethod; this.afterMethod = afterMethod; this.methodDeclarationAnalyzer = AnalyzerFactory.GetMethodDeclarationAnalyzer(); this.paraAnalzyer = AnalyzerFactory.GetParameterAnalyzer(); }
private IEnumerable<ISymbol> GetMethodReturningData(IMethodDeclarationAnalyzer methodDeclarationAnalyzer, IDocument document) { // The returning data from the return statements is initiated as empty. var returningData = Enumerable.Empty<ISymbol>(); // If having return statement, then retuning data could be not empty. if (methodDeclarationAnalyzer.HasReturnStatement()) { // Get all the return statements. var return_statements = methodDeclarationAnalyzer.GetReturnStatements(); // Get the data flow analyzer for statements. var dataFlowAnalyzer = AnalyzerFactory.GetStatementsDataFlowAnalyzer(); // Set the document to be the after one. dataFlowAnalyzer.SetDocument(document); // A list containing one statement. var stats = new List<SyntaxNode>(); foreach (var s in return_statements) { // make the list empty first. stats.Clear(); // Analyze one single return statement at each iteration stats.Add(s); dataFlowAnalyzer.SetStatements(stats); // Combining with the current result. returningData = returningData.Union(dataFlowAnalyzer.GetFlowInData()); } } logger.Info("Returning Data: " + StringUtil.ConcatenateAll(", ", returningData.Select(s => s.Name))); return returningData; }
internal InMethodChangeSignatureDetector(SyntaxNode beforeMethod, SyntaxNode afterMethod) { this.beforeMethod = beforeMethod; this.afterMethod = afterMethod; this._methodDeclarationAnalyzer = AnalyzerFactory.GetMethodDeclarationAnalyzer(); this.paraAnalzyer = AnalyzerFactory.GetParameterAnalyzer(); }