public ConvertToContractRequiresFix(ValidationResult currentStatement, ValidatedContractBlock validatedContractBlock) : base(currentStatement, validatedContractBlock) { // TODO: refactoring required!! Not clear logic _precondition = ContractsEx.Assertions.ContractStatementFactory.TryCreatePrecondition(currentStatement.Statement); }
protected MalformedContractFix(ValidationResult currentStatement, ValidatedContractBlock validatedContractBlock) { Contract.Requires(currentStatement != null); Contract.Requires(validatedContractBlock != null); _currentStatement = currentStatement; _validatedContractBlock = validatedContractBlock; }
internal CodeContractErrorHighlighting(CodeContractErrorValidationResult error, ValidatedContractBlock contractBlock) { Contract.Requires(error != null); Contract.Requires(contractBlock != null); _error = error; _contractBlock = contractBlock; _toolTip = error.GetErrorText(); }
internal CodeContractWarningHighlighting(CodeContractWarningValidationResult warning, ValidatedContractBlock contractBlock) { Contract.Requires(warning != null); Contract.Requires(contractBlock != null); _warning = warning; _contractBlock = contractBlock; _toolTip = warning.GetErrorText(); }
internal CodeContractWarningHighlighting(ICSharpStatement statement, CodeContractWarningValidationResult warning, ValidatedContractBlock contractBlock) { Contract.Requires(warning != null); Contract.Requires(contractBlock != null); Contract.Requires(statement != null); _warning = warning; _contractBlock = contractBlock; _range = statement.GetHighlightingRange(); _toolTip = warning.GetErrorText(); }
internal LegacyContractCustomWarningHighlighting(ICSharpFunctionDeclaration element, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) { Contract.Requires(warning != null); Contract.Requires(contractBlock != null); _toolTip = warning.GetErrorText(); _range = element.GetHighlightingRange(); _validationResult = warning; _contractBlock = contractBlock; MethodName = warning.GetEnclosingMethodName(); }
internal static ContractCustomWarningHighlighting Create(ICSharpStatement statement, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) { switch (warning.Warning) { case MalformedContractCustomWarning.PreconditionInAsyncMethod: case MalformedContractCustomWarning.PreconditionInMethodWithIteratorBlock: return null; default: return new ContractCustomWarningHighlighting(statement, warning, contractBlock); } }
internal CodeContractErrorHighlighting(ICSharpStatement statement, CodeContractErrorValidationResult error, ValidatedContractBlock contractBlock) { Contract.Requires(error != null); Contract.Requires(contractBlock != null); Contract.Requires(statement != null); _range = statement.GetHighlightingRange(); _error = error; _contractBlock = contractBlock; _toolTip = error.GetErrorText(); }
internal ContractCustomWarningHighlighting(CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) { Contract.Requires(warning != null); Contract.Requires(contractBlock != null); _toolTip = warning.GetErrorText(); _validationResult = warning; _contractBlock = contractBlock; MethodName = warning.GetEnclosingMethodName(); }
internal static LegacyContractCustomWarningHighlighting Create(ICSharpFunctionDeclaration element, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) { switch (warning.Warning) { case MalformedContractCustomWarning.PreconditionInAsyncMethod: return new PreconditionInAsyncMethodHighlighting(element, warning, contractBlock); case MalformedContractCustomWarning.PreconditionInMethodWithIteratorBlock: return new PreconditionInMethodWithIteratorBlockHighlighing(element, warning, contractBlock); default: return new LegacyContractCustomWarningHighlighting(element, warning, contractBlock); } }
internal ContractCustomWarningHighlighting(ICSharpStatement statement, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) { Contract.Requires(warning != null); Contract.Requires(contractBlock != null); Contract.Assert(_range != null); _range = statement.GetHighlightingRange(); _toolTip = warning.GetErrorText(); _validationResult = warning; _contractBlock = contractBlock; MethodName = warning.GetEnclosingMethodName(); }
public FixContractResultTypeInContractEnsure(ValidationResult currentStatement, ValidatedContractBlock validatedContractBlock) : base(currentStatement, validatedContractBlock) { Contract.Assert(currentStatement.ProcessedStatement.CodeContractStatement != null); var declaredMethod = currentStatement.ProcessedStatement.CodeContractStatement.GetDeclaredMethod(); _targetType = declaredMethod .With(x => x.DeclaredElement) .Return(x => x.ReturnType); _fixName = string.Format("Change to 'Contract.Result<{0}>()", _targetType.GetPresentableName(CSharpLanguage.Instance)); }
public static MalformedContractFix TryCreate(ValidationResult currentStatement, ValidatedContractBlock validatedContractBlock) { if (ConvertToContractRequiresFix.IsFixableCore(currentStatement)) return new ConvertToContractRequiresFix(currentStatement, validatedContractBlock); if (MoveStatementsOutOfTheContractBlockFix.IsFixableCore(currentStatement)) return new MoveStatementsOutOfTheContractBlockFix(currentStatement, validatedContractBlock); if (ArrangeRequiresAndEnsuresFix.IsFixableCore(currentStatement)) return new ArrangeRequiresAndEnsuresFix(currentStatement, validatedContractBlock); if (MovePreconditionsAndPostconditionsBeforeEndContractBlock.IsFixableCore(currentStatement)) return new MovePreconditionsAndPostconditionsBeforeEndContractBlock(currentStatement, validatedContractBlock); if (RemoveRedundantStatementFix.IsFixableCore(currentStatement)) return new RemoveRedundantStatementFix(currentStatement, validatedContractBlock); if (FixContractResultTypeInContractEnsure.IsFixableCore(currentStatement)) return new FixContractResultTypeInContractEnsure(currentStatement, validatedContractBlock); return null; }
public MovePreconditionsAndPostconditionsBeforeEndContractBlock(ValidationResult currentStatement, ValidatedContractBlock validatedContractBlock) : base(currentStatement, validatedContractBlock) { }
public RemoveRedundantStatementFix(ValidationResult currentStatement, ValidatedContractBlock validatedContractBlock) : base(currentStatement, validatedContractBlock) { }
internal static ContractCustomWarningHighlighting Create(ICSharpStatement statement, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) { switch (warning.Warning) { case MalformedContractCustomWarning.PreconditionInAsyncMethod: case MalformedContractCustomWarning.PreconditionInMethodWithIteratorBlock: return(null); default: return(new ContractCustomWarningHighlighting(statement, warning, contractBlock)); } }
public MoveStatementsOutOfTheContractBlockFix(ValidationResult currentStatement, ValidatedContractBlock validatedContractBlock) : base(currentStatement, validatedContractBlock) { }
public ArrangeRequiresAndEnsuresFix(ValidationResult currentStatement, ValidatedContractBlock validatedContractBlock) : base(currentStatement, validatedContractBlock) { }
public static MalformedContractFix TryCreate(ValidationResult currentStatement, ValidatedContractBlock validatedContractBlock) { if (ConvertToContractRequiresFix.IsFixableCore(currentStatement)) { return(new ConvertToContractRequiresFix(currentStatement, validatedContractBlock)); } if (MoveStatementsOutOfTheContractBlockFix.IsFixableCore(currentStatement)) { return(new MoveStatementsOutOfTheContractBlockFix(currentStatement, validatedContractBlock)); } if (ArrangeRequiresAndEnsuresFix.IsFixableCore(currentStatement)) { return(new ArrangeRequiresAndEnsuresFix(currentStatement, validatedContractBlock)); } if (MovePreconditionsAndPostconditionsBeforeEndContractBlock.IsFixableCore(currentStatement)) { return(new MovePreconditionsAndPostconditionsBeforeEndContractBlock(currentStatement, validatedContractBlock)); } if (RemoveRedundantStatementFix.IsFixableCore(currentStatement)) { return(new RemoveRedundantStatementFix(currentStatement, validatedContractBlock)); } if (FixContractResultTypeInContractEnsure.IsFixableCore(currentStatement)) { return(new FixContractResultTypeInContractEnsure(currentStatement, validatedContractBlock)); } return(null); }
internal PreconditionInMethodWithIteratorBlockHighlighing(CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) : base(warning, contractBlock) {}
internal PreconditionInMethodWithIteratorBlockHighlighing(ICSharpFunctionDeclaration element, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) : base(element, warning, contractBlock) {}
internal PreconditionInAsyncMethodHighlighting(CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) : base(warning, contractBlock) {}
internal static LegacyContractCustomWarningHighlighting Create(ICSharpFunctionDeclaration element, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) { switch (warning.Warning) { case MalformedContractCustomWarning.PreconditionInAsyncMethod: return(new PreconditionInAsyncMethodHighlighting(element, warning, contractBlock)); case MalformedContractCustomWarning.PreconditionInMethodWithIteratorBlock: return(new PreconditionInMethodWithIteratorBlockHighlighing(element, warning, contractBlock)); default: return(new LegacyContractCustomWarningHighlighting(element, warning, contractBlock)); } }
internal PreconditionInAsyncMethodHighlighting(ICSharpFunctionDeclaration element, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) : base(element, warning, contractBlock) { }