public ControlFlowInspector([NotNull] ICSharpFunctionDeclaration functionDeclaration, [NotNull] CSharpControlFlowGraf graf, [NotNull] ITypeElement disposableInterface) : base(functionDeclaration, graf) { _disposableInterface = disposableInterface; _disposableArguments = GetDisposableArguments(); if (_disposableArguments != null) { _processThis = IsThisDisposable(); _elementDataStorage = InitElementDataStorage(); _psiSourceFile = functionDeclaration.GetSourceFile(); } }
public IEnumerable<HighlightingInfo> Inspect() { _elementDataStorage = new ControlFlowElementDataStorage(); var initialData = new ControlFlowElementData(Graf.EntryElement.Id) { ThisStatus = VariableDisposeStatus.NotDisposed }; _elementDataStorage[Graf.EntryElement] = initialData; var nodeHandlerFactory = new TreeNodeHandlerFactory(_maxLevel, _disposableInterface); DoStep(null, Graf.EntryElement, true, nodeHandlerFactory, _elementDataStorage); AddHighlightings(); return _highlightings; }
private ControlFlowElementDataStorage InitElementDataStorage() { var elementDataStorage = new ControlFlowElementDataStorage(); var initialData = new ControlFlowElementData(Graf.EntryElement.Id); if (_disposableArguments != null) _disposableArguments.ForEach(kvp => initialData[kvp.Key] = VariableDisposeStatus.NotDisposed); if (_processThis) initialData.ThisStatus = VariableDisposeStatus.NotDisposed; elementDataStorage[Graf.EntryElement] = initialData; return elementDataStorage; }