public override ICodeIssueComputer CheckInlineMethodCondition(IDocument before, IDocument after, IInlineMethodRefactoring refactoring) { // Get the out going symbols before the method is inlined. var writtenSymbolsBeforeInline = ConditionCheckersUtils.GetFlowOutData(ConditionCheckersUtils.GetStatementEnclosingNode (refactoring.InlinedMethodInvocation), before); // Get the out going symbols after the method is inlined. var writtenSymbolsAfterInline = ConditionCheckersUtils.GetFlowOutData(refactoring.InlinedStatementsInMethodAfter, after); // Calculate the symbols that are added by inlining method. var addedSymbols = ConditionCheckersUtils.GetSymbolListExceptByName(writtenSymbolsAfterInline, writtenSymbolsBeforeInline); // Calculate the symbols that are removed by inlining method. var missingSymbols = ConditionCheckersUtils.GetSymbolListExceptByName(writtenSymbolsBeforeInline, writtenSymbolsAfterInline); // Remove 'this' symbol, it is trivial to include. addedSymbols = ConditionCheckersUtils.RemoveThisSymbol(addedSymbols); missingSymbols = ConditionCheckersUtils.RemoveThisSymbol(missingSymbols); // If found any missing and additional symbols, return a code issue computer. if(addedSymbols.Any() || missingSymbols.Any()) { logger.Info("Additional changed symbols: " + StringUtil.ConcatenateAll(",", addedSymbols.Select(s => s.Name))); logger.Info("Missing changed symbols: " + StringUtil.ConcatenateAll(",", missingSymbols.Select(s => s.Name))); return new ModifiedFlowOutData(refactoring.CallerMethodAfter, refactoring.InlinedMethod, refactoring.InlinedMethodInvocation, refactoring.InlinedStatementsInMethodAfter, addedSymbols, missingSymbols); } return new NullCodeIssueComputer(); }
public override IConditionCheckingResult CheckInlineMethodCondition(IInlineMethodRefactoring refactoring) { throw new NotImplementedException(); }
public abstract IConditionCheckingResult CheckInlineMethodCondition(IInlineMethodRefactoring refactoring);
public override ICodeIssueComputer CheckInlineMethodCondition(IDocument before, IDocument after, IInlineMethodRefactoring refactoring) { return new NullCodeIssueComputer(); }