protected override void Run(ICSharpFunctionDeclaration element, ElementProblemAnalyzerData data, IHighlightingConsumer consumer) { var preconditions = CodeContractBlockValidator.ValidateLegacyRequires(element.GetLegacyContractBlockStatements()); foreach (var vr in preconditions.ValidationResults) { var highlighting = vr.Match( error => (IHighlighting)null, warning => null, customWarning => LegacyContractCustomWarningHighlighting.Create(element, customWarning, preconditions), _ => null); if (highlighting != null) { consumer.AddHighlighting(highlighting, vr.Statement.GetDocumentRange(), element.GetContainingFile()); } } }
public LegacyContractFix(LegacyContractCustomWarningHighlighting legacyContractCustomWarning) { Contract.Requires(legacyContractCustomWarning != null); _legacyContractCustomWarning = legacyContractCustomWarning; }