/// <summary> /// Executes the internal. /// </summary> /// <param name="element"> /// The element. /// </param> protected override void Execute(IElement element) { var typeMemberDeclaration = this.GetTypeMemberDeclaration(); if (typeMemberDeclaration == null) { return; } var valueAnalysisRefactoring = new ValueAnalysisRefactoring(typeMemberDeclaration); valueAnalysisRefactoring.Execute(); if (!ValueAnalysisSettings.Instance.ExecuteGhostDoc) { return; } }
/// <summary>Checks the declaration documentation.</summary> /// <param name="declaration">The declaration.</param> /// <param name="options">The options.</param> private void Annotate(IDeclaration declaration, ValueAnalysisOptions options) { if (!options.AnnotateWithValueAnalysisAttributes && !options.InsertAssertStatements) { return; } var typeMemberDeclaration = declaration as ITypeMemberDeclaration; if (typeMemberDeclaration == null) { return; } var refactoring = new ValueAnalysisRefactoring(typeMemberDeclaration); refactoring.AnnotateWithValueAnalysisAttributes = options.AnnotateWithValueAnalysisAttributes; refactoring.InsertAssertStatements = options.InsertAssertStatements; refactoring.TreatAllMembersAsNonPublic = options.TreatAllMembersAsNonPublic; refactoring.Execute(); }
/// <summary> /// Analyzes the specified statement. /// </summary> /// <param name="typeMemberDeclaration"> /// The type member declaration. /// </param> /// <returns> /// Returns the suggestion base[]. /// </returns> public SuggestionBase[] Analyze(ITypeMemberDeclaration typeMemberDeclaration) { var modifiersOwnerDeclaration = typeMemberDeclaration as IModifiersOwnerDeclaration; if (modifiersOwnerDeclaration == null) { return null; } var valueAnalysisRefactoring = new ValueAnalysisRefactoring(typeMemberDeclaration); if (!valueAnalysisRefactoring.IsAvailable()) { return null; } var suggestions = new List<SuggestionBase>(); suggestions.Add(new ValueAnalysisSuggestion(this.solution, typeMemberDeclaration)); return suggestions.ToArray(); }
/// <summary> /// Determines whether this instance is available. /// </summary> /// <param name="element"> /// The element. /// </param> /// <returns> /// <c>true</c> if this instance is available; otherwise, <c>false</c>. /// </returns> protected override bool IsAvailable(IElement element) { var typeMemberDeclaration = this.GetTypeMemberDeclaration(); if (typeMemberDeclaration == null) { return false; } var valueAnalysisRefactoring = new ValueAnalysisRefactoring(typeMemberDeclaration); return valueAnalysisRefactoring.IsAvailable(); }