Beispiel #1
0
        /// <summary>
        /// AnalyzeScript: Analyzes the ast to check that if the ShouldProcess attribute is present, the function calls ShouldProcess and vice versa.
        /// </summary>
        /// <param name="ast">The script's ast</param>
        /// <param name="fileName">The script's file name</param>
        /// <returns>A List of diagnostic results of this rule</returns>
        public IEnumerable <DiagnosticRecord> AnalyzeScript(Ast ast, string fileName)
        {
            if (ast == null)
            {
                throw new ArgumentNullException(Strings.NullAstErrorMessage);
            }

            diagnosticRecords.Clear();
            this.ast      = ast;
            this.fileName = fileName;
            funcDigraph   = new FunctionReferenceDigraph();
            ast.Visit(funcDigraph);
            CheckForSupportShouldProcess();
            FindViolations();
            foreach (var dr in diagnosticRecords)
            {
                yield return(dr);
            }
        }